Package org.eclipse.osgi.storage.url

# Class BundleResourceHandler

java.lang.Object
java.net.URLStreamHandler
org.eclipse.osgi.storage.url.BundleResourceHandler

Direct Known Subclasses:
  `Handler`, `Handler`

public abstract class BundleResourceHandler extends URLStreamHandler
URLStreamHandler the bundleentry and bundleresource protocols.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`BID_FWKID_SEPARATOR`
`protected BundleEntry`
`bundleEntry`
`protected final ModuleContainer`
`container`
`static final String`
`OSGI_ENTRY_URL_PROTOCOL`
`static final String`
`OSGI_RESOURCE_URL_PROTOCOL`
`static final String`
`SECURITY_CHECKED`
`static final String`
`SECURITY_UNCHECKED`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`BundleResourceHandler(ModuleContainer container, BundleEntry bundleEntry)`

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`checkAuthorization(Module module)`
`static String`
`createURLHostForBundleID(ModuleContainer container, long bundleId)`
`protected boolean`
`equals(URL url1, URL url2)`
`protected abstract BundleEntry`
`findBundleEntry(URL url, Module module)`
Finds the bundle entry for this protocal.
`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)`
`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 Details

### OSGI_RESOURCE_URL_PROTOCOL

public static final String OSGI_RESOURCE_URL_PROTOCOL

See Also:
  - Constant Field Values

### OSGI_ENTRY_URL_PROTOCOL

public static final String OSGI_ENTRY_URL_PROTOCOL

See Also:
  - Constant Field Values

### 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

### container

protected final ModuleContainer container

### bundleEntry

protected BundleEntry bundleEntry

## Constructor Details

### BundleResourceHandler

protected BundleResourceHandler(ModuleContainer container, BundleEntry bundleEntry)

## Method Details

### 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, Module module) 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 entry for.
  `module` - the module to find the entry 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(Module module)

### createURLHostForBundleID

public static String createURLHostForBundleID(ModuleContainer container, long bundleId)