org.eclipse.osgi.framework.internal.core
Class BundleResourceHandler

java.lang.Object
  extended by java.net.URLStreamHandler
      extended by org.eclipse.osgi.framework.internal.core.BundleResourceHandler
All Implemented Interfaces:
ProtocolActivator
Direct Known Subclasses:
Handler, Handler

public abstract class BundleResourceHandler
extends URLStreamHandler
implements ProtocolActivator

URLStreamHandler the bundleentry and bundleresource protocols.


Field Summary
static String BID_FWKID_SEPARATOR
           
protected  BundleEntry bundleEntry
           
static String SECURITY_CHECKED
           
static String SECURITY_UNCHECKED
           
 
Constructor Summary
BundleResourceHandler()
          Constructor for a bundle protocol resource URLStreamHandler.
BundleResourceHandler(BundleEntry bundleEntry, BaseAdaptor adaptor)
           
 
Method Summary
protected  boolean checkAuthorization(Bundle bundle)
           
protected  boolean equals(URL url1, URL url2)
           
protected abstract  BundleEntry findBundleEntry(URL url, AbstractBundle bundle)
          Finds the bundle entry for this protocal.
protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle)
           
protected  InetAddress getHostAddress(URL url)
           
protected  int hashCode(URL url)
           
protected  boolean hostsEqual(URL url1, URL url2)
           
protected  URLConnection openConnection(URL url)
          Establishes a connection to the resource specified by URL.
protected  void parseURL(URL url, String str, int start, int end)
          Parse reference URL.
protected  boolean sameFile(URL url1, URL url2)
           
 void start(BundleContext context, FrameworkAdaptor baseAdaptor)
           
protected  String toExternalForm(URL url)
          Converts a bundle URL to a String.
 
Methods inherited from class java.net.URLStreamHandler
getDefaultPort, openConnection, setURL, setURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECURITY_CHECKED

public static final String SECURITY_CHECKED
See Also:
Constant Field Values

SECURITY_UNCHECKED

public static final String SECURITY_UNCHECKED
See Also:
Constant Field Values

BID_FWKID_SEPARATOR

public static final String BID_FWKID_SEPARATOR
See Also:
Constant Field Values

bundleEntry

protected BundleEntry bundleEntry
Constructor Detail

BundleResourceHandler

public BundleResourceHandler()
Constructor for a bundle protocol resource URLStreamHandler.


BundleResourceHandler

public BundleResourceHandler(BundleEntry bundleEntry,
                             BaseAdaptor adaptor)
Method Detail

start

public void start(BundleContext context,
                  FrameworkAdaptor baseAdaptor)
Specified by:
start in interface ProtocolActivator

parseURL

protected void parseURL(URL url,
                        String str,
                        int start,
                        int end)
Parse reference URL.

Overrides:
parseURL in class URLStreamHandler

openConnection

protected URLConnection openConnection(URL url)
                                throws IOException
Establishes a connection to the resource specified by URL. Since different protocols may have unique ways of connecting, it must be overridden by the subclass.

Specified by:
openConnection in class URLStreamHandler
Parameters:
url - java.net.URL
Returns:
java.net.URLConnection
Throws:
IOException - thrown if an IO error occurs during connection establishment

findBundleEntry

protected abstract BundleEntry findBundleEntry(URL url,
                                               AbstractBundle bundle)
                                        throws IOException
Finds the bundle entry for this protocal. This is handled differently for Bundle.gerResource() and Bundle.getEntry() because getResource uses the bundle classloader and getEntry only used the base bundle file.

Parameters:
url - The URL to find the BundleEntry for.
Returns:
the bundle entry
Throws:
IOException

toExternalForm

protected String toExternalForm(URL url)
Converts a bundle URL to a String.

Overrides:
toExternalForm in class URLStreamHandler
Parameters:
url - the URL.
Returns:
a string representation of the URL.

hashCode

protected int hashCode(URL url)
Overrides:
hashCode in class URLStreamHandler

equals

protected boolean equals(URL url1,
                         URL url2)
Overrides:
equals in class URLStreamHandler

getHostAddress

protected InetAddress getHostAddress(URL url)
Overrides:
getHostAddress in class URLStreamHandler

hostsEqual

protected boolean hostsEqual(URL url1,
                             URL url2)
Overrides:
hostsEqual in class URLStreamHandler

sameFile

protected boolean sameFile(URL url1,
                           URL url2)
Overrides:
sameFile in class URLStreamHandler

checkAuthorization

protected boolean checkAuthorization(Bundle bundle)

getBundleClassLoader

protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle)


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.