Package org.eclipse.osgi.storage.url

# Class BundleResourceHandler

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

All Implemented Interfaces:
  `PlurlStreamHandler`

Direct Known Subclasses:
  `Handler`, `Handler`

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

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.equinox.plurl.PlurlStreamHandler

`PlurlStreamHandler.PlurlSetter`

## 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)`
`boolean`
`equals(URL url1, URL url2)`
This method calls `super.equals(URL,URL)`.
`protected abstract BundleEntry`
`findBundleEntry(URL url, Module module)`
Finds the bundle entry for this protocal.
`InetAddress`
`getHostAddress(URL url)`
This method calls `super.getHostAddress`.
`int`
`hashCode(URL url)`
This method calls `super.hashCode(URL)`.
`boolean`
`hostsEqual(URL url1, URL url2)`
This method calls `super.hostsEqual`.
`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.
`boolean`
`sameFile(URL url1, URL url2)`
This method calls `super.sameFile`.
`String`
`toExternalForm(URL url)`
Converts a bundle URL to a String.

### Methods inherited from class org.eclipse.equinox.plurl.PlurlStreamHandlerBase

`getDefaultPort, openConnection, parseURL, 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

public 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 interface `PlurlStreamHandler`
Specified by:
  `openConnection` in class `PlurlStreamHandlerBase`
Parameters:
  `url` - java.net.URL
Returns:
  java.net.URLConnection
Throws:
  `IOException` - thrown if an IO error occurs during connection establishment
See Also:
  - "java.net.URLStreamHandler.openConnection(URL)"

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

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

Specified by:
  `toExternalForm` in interface `PlurlStreamHandler`
Overrides:
  `toExternalForm` in class `PlurlStreamHandlerBase`
Parameters:
  `url` - the URL.
Returns:
  a string representation of the URL.
See Also:
  - "java.net.URLStreamHandler.toExternalForm"

### hashCode

public int hashCode(URL url)
Description copied from class: `PlurlStreamHandlerBase`
This method calls `super.hashCode(URL)`.

Specified by:
  `hashCode` in interface `PlurlStreamHandler`
Overrides:
  `hashCode` in class `PlurlStreamHandlerBase`
See Also:
  - "java.net.URLStreamHandler.hashCode(URL)"

### equals

public boolean equals(URL url1, URL url2)
Description copied from class: `PlurlStreamHandlerBase`
This method calls `super.equals(URL,URL)`.

Specified by:
  `equals` in interface `PlurlStreamHandler`
Overrides:
  `equals` in class `PlurlStreamHandlerBase`
See Also:
  - "java.net.URLStreamHandler.equals(URL,URL)"

### getHostAddress

public InetAddress getHostAddress(URL url)
Description copied from class: `PlurlStreamHandlerBase`
This method calls `super.getHostAddress`.

Specified by:
  `getHostAddress` in interface `PlurlStreamHandler`
Overrides:
  `getHostAddress` in class `PlurlStreamHandlerBase`
See Also:
  - "java.net.URLStreamHandler.getHostAddress"

### hostsEqual

public boolean hostsEqual(URL url1, URL url2)
Description copied from class: `PlurlStreamHandlerBase`
This method calls `super.hostsEqual`.

Specified by:
  `hostsEqual` in interface `PlurlStreamHandler`
Overrides:
  `hostsEqual` in class `PlurlStreamHandlerBase`
See Also:
  - "java.net.URLStreamHandler.hostsEqual"

### sameFile

public boolean sameFile(URL url1, URL url2)
Description copied from class: `PlurlStreamHandlerBase`
This method calls `super.sameFile`.

Specified by:
  `sameFile` in interface `PlurlStreamHandler`
Overrides:
  `sameFile` in class `PlurlStreamHandlerBase`
See Also:
  - "java.net.URLStreamHandler.sameFile"

### checkAuthorization

protected boolean checkAuthorization(Module module)

### createURLHostForBundleID

public static String createURLHostForBundleID(ModuleContainer container, long bundleId)