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
Direct Known Subclasses:
Handler, Handler

public abstract class BundleResourceHandler
extends java.net.URLStreamHandler

URLStreamHandler the bundleentry and bundleresource protocols.


Field Summary
protected  BundleEntry bundleEntry
           
protected static BundleContext context
           
static java.lang.String SECURITY_AUTHORIZED
           
 
Constructor Summary
BundleResourceHandler()
          Constructor for a bundle protocol resource URLStreamHandler.
BundleResourceHandler(BundleEntry bundleEntry)
           
 
Method Summary
protected  void checkAdminPermission(Bundle bundle)
           
protected  boolean equals(java.net.URL url1, java.net.URL url2)
           
protected abstract  BundleEntry findBundleEntry(java.net.URL url, AbstractBundle bundle)
          Finds the bundle entry for this protocal.
protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle)
           
protected  java.net.InetAddress getHostAddress(java.net.URL url)
           
protected  int hashCode(java.net.URL url)
           
protected  boolean hostsEqual(java.net.URL url1, java.net.URL url2)
           
protected  java.net.URLConnection openConnection(java.net.URL url)
          Establishes a connection to the resource specified by URL.
protected  void parseURL(java.net.URL url, java.lang.String str, int start, int end)
          Parse reference URL.
protected  boolean sameFile(java.net.URL url1, java.net.URL url2)
           
static void setContext(BundleContext context)
           
protected  java.lang.String toExternalForm(java.net.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_AUTHORIZED

public static final java.lang.String SECURITY_AUTHORIZED
See Also:
Constant Field Values

context

protected static BundleContext context

bundleEntry

protected BundleEntry bundleEntry
Constructor Detail

BundleResourceHandler

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


BundleResourceHandler

public BundleResourceHandler(BundleEntry bundleEntry)
Method Detail

parseURL

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

Overrides:
parseURL in class java.net.URLStreamHandler

openConnection

protected java.net.URLConnection openConnection(java.net.URL url)
                                         throws java.io.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 java.net.URLStreamHandler
Parameters:
url - java.net.URL
Returns:
java.net.URLConnection
Throws:
java.io.IOException - thrown if an IO error occurs during connection establishment

findBundleEntry

protected abstract BundleEntry findBundleEntry(java.net.URL url,
                                               AbstractBundle bundle)
                                        throws java.io.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:
java.io.IOException

toExternalForm

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

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

setContext

public static void setContext(BundleContext context)

hashCode

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

equals

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

getHostAddress

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

hostsEqual

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

sameFile

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

checkAdminPermission

protected void checkAdminPermission(Bundle bundle)

getBundleClassLoader

protected static BaseClassLoader getBundleClassLoader(AbstractBundle bundle)