1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
/*******************************************************************************
* Copyright (c) 2003, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.framework.internal.protocol.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: <p>
* <pre>
* reference:file:/eclipse/plugins/org.eclipse.myplugin_1.0.0/
* reference:file:/eclispe/plugins/org.eclipse.mybundle_1.0.0.jar
* </pre>
*/
public class Handler extends URLStreamHandler {
/**
* @throws IOException
*/
protected URLConnection openConnection(URL url) throws IOException {
return new ReferenceURLConnection(url);
}
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);
}
}
|