All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.osgi.storage.url.reference.Handler Maven / Gradle / Ivy

Go to download

AspectJ tools most notably contains the AspectJ compiler (AJC). AJC applies aspects to Java classes during compilation, fully replacing Javac for plain Java classes and also compiling native AspectJ or annotation-based @AspectJ syntax. Furthermore, AJC can weave aspects into existing class files in a post-compile binary weaving step. This library is a superset of AspectJ weaver and hence also of AspectJ runtime.

There is a newer version: 1.9.22.1
Show newest version
/*******************************************************************************
 * Copyright (c) 2003, 2012 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.osgi.storage.url.reference;

import java.io.IOException;
import java.net.*;

/**
 * URLStreamHandler for reference protocol.  A reference URL is used to hold a
 * reference to a local file URL.  A reference URL allows bundles to be installed
 * by reference.  This means the content of the bundle will not be copied.  Instead
 * the content of the bundle will be loaded from the reference location specified
 * by the reference URL.  The Framework only supports reference URLs that refer
 * to a local file URL.  For example: 

*

 *     reference:file:/eclipse/plugins/org.eclipse.myplugin_1.0.0/
 *     reference:file:/eclispe/plugins/org.eclipse.mybundle_1.0.0.jar
 * 
*/ public class Handler extends URLStreamHandler { private final String installPath; public Handler(String installURL) { super(); if (installURL != null && installURL.startsWith("file:")) { //$NON-NLS-1$ // this is the safest way to create a File object off a file: URL this.installPath = installURL.substring(5); } else { this.installPath = null; } } /** * @throws IOException */ @Override protected URLConnection openConnection(URL url) throws IOException { return new ReferenceURLConnection(url, installPath); } @Override protected void parseURL(URL url, String str, int start, int end) { if (end < start) { return; } String reference = (start < end) ? str.substring(start, end) : url.getPath(); setURL(url, url.getProtocol(), null, -1, null, null, reference, null, null); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy