HTTP wrapper service

When you install the Apache Karaf Cave Server, it starts a HTTP service wrapper.

It means that all artifacts and OBR metadata presents in local repositories are exposed over HTTP.

OBR metadata access

Assuming that you have the following repositories:

karaf@root()> cave:repositories
Name          | Location
--------------------------------------------------------------------
my-repository | /home/jbonofre/apache-karaf-3.0.1/cave/my-repository
m2            | /home/jbonofre/.m2/repository

You can access the OBR metadata using the following URL in your favorite browser:

http://localhost:8181/cave/m2-repository.xml

and

http://localhost:8181/cave/my-repository-repository.xml
Note

The port 8181 is the default one of the Apache Karaf HTTP service.

You can see that the URL follows the format:

You can note the OBR metadata Cave URL format:

http://[cave_server_hostname]:[http_service_port]/cave/[cave_repository_name]-repository.xml

It means that you can register the repositories on remote Apache Karaf instances.

In a remote Apache Karaf instance, you just have to install the obr feature and register the HTTP wrapper repository.xml URL:

karaf@other()> feature:install obr
karaf@other()> obr:url-add http://cave_server:8181/cave/cave-repo-repository.xml
karaf@other()> obr:url-add http://cave_server:8181/cave/m2-repository.xml

OSGi bundles access

Apache Karaf Cave HTTP wrapper service also provide the OSGi bundles binaries via HTTP.

For instance, you have register the my-repository repository in the OBR service:

karaf@root()> cave:repository-install my-repository

So you have the following bundles available in the OBR service:

karaf@root()> obr:list
Name                                                                                                  | Symbolic Name                                                       | Version
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Apache ServiceMix :: Bundles :: commons-dbcp                                                          | org.apache.servicemix.bundles.commons-dbcp                          | 1.4.0.3
...

If we take a look on the detail of the commons-dbcp bundle:

karaf@root()> obr:info org.apache.servicemix.bundles.commons-dbcp
--------------------------------------------
Apache ServiceMix :: Bundles :: commons-dbcp
--------------------------------------------
id: org.apache.servicemix.bundles.commons-dbcp/1.4.0.3
description: This OSGi bundle wraps commons-dbcp 1.4 jar file.
documentation: http://www.apache.org/
symbolicname: org.apache.servicemix.bundles.commons-dbcp
presentationname: Apache ServiceMix :: Bundles :: commons-dbcp
license: http://www.apache.org/licenses/LICENSE-2.0.txt
uri: file:/home/jbonofre/.m2/repository/org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_3/org.apache.servicemix.bundles.commons-dbcp-1.4_3.jar
size: 171252
version: 1.4.0.3
Requires:
   package:(&(package=javax.naming))
   package:(&(package=javax.naming.spi))
   package:(&(package=javax.sql))
   package:(&(package=javax.transaction))
   package:(&(package=javax.transaction.xa))
   package:(&(package=org.apache.commons.pool)(version>=1.3.0)(!(version>=2.0.0)))
   package:(&(package=org.apache.commons.pool.impl)(version>=1.3.0)(!(version>=2.0.0)))
   package:(&(package=org.xml.sax))
   package:(&(package=org.xml.sax.helpers))
Capabilities:
   bundle:{manifestversion=2, symbolicname=org.apache.servicemix.bundles.commons-dbcp, presentationname=Apache ServiceMix :: Bundles :: commons-dbcp, version=1.4.0.3}
   package:{package=org.apache.commons.dbcp.cpdsadapter, uses:=org.apache.commons.dbcp,javax.naming,javax.sql,org.apache.commons.pool.impl,org.apache.commons.pool,javax.naming.spi, version=1.4.0}
   package:{package=org.apache.commons.dbcp, uses:=org.apache.commons.pool.impl,org.apache.commons.pool,javax.sql,javax.naming,javax.naming.spi,org.apache.commons.jocl,org.xml.sax, version=1.4.0}
   package:{package=org.apache.commons.dbcp.managed, uses:=org.apache.commons.dbcp,javax.sql,org.apache.commons.pool.impl,javax.transaction,org.apache.commons.pool,javax.transaction.xa, version=1.4.0}
   package:{package=org.apache.commons.dbcp.datasources, uses:=javax.sql,org.apache.commons.pool,javax.naming,org.apache.commons.dbcp,javax.naming.spi,org.apache.commons.pool.impl, version=1.4.0}
   package:{package=org.apache.commons.jocl, uses:=org.xml.sax.helpers,org.xml.sax, version=1.4.0}

we can see that the URI is file:/home/jbonofre/.m2/repository/org/apache/servicemix/bundles/org.apache.servicemix.bundles.commons-dbcp/1.4_3/org.apache.servicemix.bundles.commons-dbcp-1.4_3.jar.

But the HTTP wrapper service also exposes the bundle on:

http://localhost:8181/cave/org.apache.servicemix.bundles.commons-dbcp-1.4.0.3.jar

Actually, Apache Karaf Cave handles bundle URI relatively to the repository.

So, it means that, if you register the my-repository repository on a remote Apache Karaf instance:

karaf@other()> feature:install obr
karaf@other()> obr:url-add http://cave_server:8181/cave/my-repository-repository.xml

you can take a look on the commons-dbcp details:

karaf@root()> obr:info org.apache.servicemix.bundles.commons-dbcp
--------------------------------------------
Apache ServiceMix :: Bundles :: commons-dbcp
--------------------------------------------
id: org.apache.servicemix.bundles.commons-dbcp/1.4.0.3
description: This OSGi bundle wraps commons-dbcp 1.4 jar file.
documentation: http://www.apache.org/
symbolicname: org.apache.servicemix.bundles.commons-dbcp
presentationname: Apache ServiceMix :: Bundles :: commons-dbcp
license: http://www.apache.org/licenses/LICENSE-2.0.txt
uri: http://localhost:8181/cave/org.apache.servicemix.bundles.commons-dbcp-1.4.0.3.jar
size: 171252
version: 1.4.0.3
Requires:
   package:(&(package=javax.naming))
   package:(&(package=javax.naming.spi))
   package:(&(package=javax.sql))
   package:(&(package=javax.transaction))
   package:(&(package=javax.transaction.xa))
   package:(&(package=org.apache.commons.pool)(version>=1.3.0)(!(version>=2.0.0)))
   package:(&(package=org.apache.commons.pool.impl)(version>=1.3.0)(!(version>=2.0.0)))
   package:(&(package=org.xml.sax))
   package:(&(package=org.xml.sax.helpers))
Capabilities:
   bundle:{manifestversion=2, symbolicname=org.apache.servicemix.bundles.commons-dbcp, presentationname=Apache ServiceMix :: Bundles :: commons-dbcp, version=1.4.0.3}
   package:{package=org.apache.commons.dbcp.cpdsadapter, uses:=org.apache.commons.dbcp,javax.naming,javax.sql,org.apache.commons.pool.impl,org.apache.commons.pool,javax.naming.spi, version=1.4.0}
   package:{package=org.apache.commons.dbcp, uses:=org.apache.commons.pool.impl,org.apache.commons.pool,javax.sql,javax.naming,javax.naming.spi,org.apache.commons.jocl,org.xml.sax, version=1.4.0}
   package:{package=org.apache.commons.dbcp.managed, uses:=org.apache.commons.dbcp,javax.sql,org.apache.commons.pool.impl,javax.transaction,org.apache.commons.pool,javax.transaction.xa, version=1.4.0}
   package:{package=org.apache.commons.dbcp.datasources, uses:=javax.sql,org.apache.commons.pool,javax.naming,org.apache.commons.dbcp,javax.naming.spi,org.apache.commons.pool.impl, version=1.4.0}
   package:{package=org.apache.commons.jocl, uses:=org.xml.sax.helpers,org.xml.sax, version=1.4.0}

It means that we can use directly obr:deploy command:

karaf@root> obr:deploy org.apache.servicemix.bundles.commons-dbcp
Target resource(s):
-------------------
   Apache ServiceMix :: Bundles :: commons-dbcp (1.4.0.3)

Required resource(s):
---------------------
   Apache ServiceMix :: Bundles :: commons-pool (1.5.4.3)

Deploying...done.