org.apache.felix.ipojo.online.manipulator

## Class IPOJOURLHandler

- java.lang.Object
- - java.net.URLStreamHandler
  - - org.osgi.service.url.AbstractURLStreamHandlerService
    - - org.apache.felix.ipojo.online.manipulator.IPOJOURLHandler

All Implemented Interfaces:
  org.osgi.service.url.URLStreamHandlerService

    public class IPOJOURLHandler
    extends org.osgi.service.url.AbstractURLStreamHandlerService

iPOJO URL Handler allowing installation time manipulation. When a bundle is installed with the ipojo URL prefix, the referred bundle is manipulated by this handler. The metadata.xml file can either be provided:

- Inside the bundle, this handler will look for /metadata.xml (at the root of the bundle) or in /META-INF/metadata.xml
- Through the URL using the following URL format: ipojo:URL_BUNDLE!URL_METADATA, notice the ! used as separator

Examples of valid iPojo's URLs:

         ipojo:file:///tmp/bundle.jar
         ipojo:/http://www.example.org/bundle.jar
         ipojo://mvn://com.acme/bundle/1.0.0  (with Maven Pax Url support installed)
         ipojo:file:///tmp/bundle.jar!file:///tmp2/metadata.xml

Notice that trailing '/' (or '//') after ipojo: are optional.

Author:
  Felix Project Team

### Field Summary

Fields
`static String` `IPOJO_SCHEME`

### Fields inherited from class org.osgi.service.url.AbstractURLStreamHandlerService

`realHandler`

### Constructor Summary

Constructors
Constructor and Description
`IPOJOURLHandler(org.osgi.framework.BundleContext bundleContext)` Creates a IPOJOURLHandler.
`IPOJOURLHandler(org.osgi.framework.BundleContext context, File work)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `bindModule(org.apache.felix.ipojo.manipulator.spi.Module module)`
`URLConnection` `openConnection(URL url)` Opens a connection using the ipojo url handler.
`void` `stop()` Stops the URL handler: Deletes the working directory.
`void` `unbindModule(org.apache.felix.ipojo.manipulator.spi.Module module)`

### Methods inherited from class org.osgi.service.url.AbstractURLStreamHandlerService

`equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, parseURL, sameFile, setURL, setURL, toExternalForm`

### Methods inherited from class java.net.URLStreamHandler

`openConnection, parseURL`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### IPOJO_SCHEME

    public static final String IPOJO_SCHEME

See Also:
  Constant Field Values

### Constructor Detail

#### IPOJOURLHandler

    public IPOJOURLHandler(org.osgi.framework.BundleContext bundleContext)

Creates a IPOJOURLHandler. Gets the bundle context and create the working directory.

Parameters:
  `bundleContext` - the bundle context

#### IPOJOURLHandler

    public IPOJOURLHandler(org.osgi.framework.BundleContext context,
                           File work)

### Method Detail

#### bindModule

    public void bindModule(org.apache.felix.ipojo.manipulator.spi.Module module)

#### unbindModule

    public void unbindModule(org.apache.felix.ipojo.manipulator.spi.Module module)

#### stop

    public void stop()

Stops the URL handler: Deletes the working directory.

#### openConnection

    public URLConnection openConnection(URL url)
                                 throws IOException

Opens a connection using the ipojo url handler. This methods parses the URL and manipulate the given bundle.

Specified by:
  `openConnection` in interface `org.osgi.service.url.URLStreamHandlerService`
Specified by:
  `openConnection` in class `org.osgi.service.url.AbstractURLStreamHandlerService`
Parameters:
  `url` - the url.
Returns:
  the URL connection on the manipulated bundle
Throws:
  `IOException` - occurs when the bundle cannot be either downloaded, or manipulated or installed correctly.
See Also:
  `AbstractURLStreamHandlerService.openConnection(java.net.URL)`