Pax URL Wrap is an OSGi URL handler that can process your legacy jar at runtime and transform it into an OSGi bundle.
Imagine this. You have a bundle that requires a set of existing jars in order to work. As for example Apache Commons Lang. What you could do? Look first on Apache Felix Commons to find out if is not already wrapped and use that jar. But what if is not there or the version you are looking for is not there? What if is your own jar? Of course you could wrap it yourself but wouldn't be easier that you could just use an url wrap it? That's why this handler was made.
By using the wrap protocol you can wrap an existing jar as an OSGi bundle. The wrapping process can be done in different ways:
- without any processing instructions;
- by specifying wrapping instructions file;
- by encoding the instructions in the url
It uses Peter's Kriens bnd tool for carrying out the actual wrapping process.
Syntax ( see #examples )
The following instructions are mandatory for wrapping a jar as an OSGi bundle, so if not found in the wrapping file or wrapping instructions a default value will be used as follows:
all packages from the wrapped jar
made up out of the wrapped jar url where all characters that are not in [a-zA-Z_0-9-] are replaced with "_"
The service can be configured in two ways: via configuration admin if available and via framework/system properties where the configuration via config admin has priority.
optional; true/false if the SSL certificate check should be done while accesing the wrapped jar url and wrapping instructions url. Default false.
Wraps apache commons logging version 1.1 found on working directory using #default instructions:
Wraps apache commons logging version 1.1 found by using mvn: protocol using instructions from commons-logging-1.1.bnd from local directory:
Wraps apache commons logging version 1.1 found by using mvn: protocol using instructions Bundle-SymbolicName=JCL and Bundle-Version=1.1:
Wraps apache commons logging version 1.1 found by using mvn: protocol using instructions from commons-logging-1.1.bnd from local directory and instructions Bundle-SymbolicName=JCL and Bundle-Version=1.1:
Wraps infinispan version 5.2.6.final found by using mvn: protocol using instructions the existing manifest and merging those with some fixed informations about Import-Package and Export-Package:
NOTE: Beware that you may need to escape the $ character which precedes the instruction list if you are using a shell. That is, precede the dollar sign with a backslash:
\$. Otherwise, your instruction may be interpreted as a variable name and consequently the shell will attempt to resolve it.