OBR commands
To install a repository in the OBR service, you have to use:
karaf@root()> cave:repository-install cave-repo
Now, you can see the repository OBR metadata register in the OBR service:
karaf@root()> obr:url-list Index | OBR URL -------------------------------------------------------------------------------- 0 | file:/home/jbonofre/apache-karaf-3.0.1/cave/my-repository/repository.xml
And the OSGi bundles present in the repository OSGi bundles are 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 ...
You can get some detail about an OSGi bundle:
karaf@root()> obr:info org.apache.servicemix.bundles.commons-dbcp,1.4.0.3 -------------------------------------------- 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/apache-karaf-3.0.1/cave/my-repository/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}
Note
|
In Apache Karaf, the OBR entry format is symbolicname,version |
You have the details of the OSGi bundle, especially the requirements and capabilities of the bundle.
OBR is able to resolve the dependencies between bundles, depending of the requirements and capabilities of each bundle. It’s able to manage version, etc.
For instance, we have the following commons-dbcp bundle 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: file:/home/jbonofre/apache-karaf-3.0.1/cave/my-repository/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}
We can see that commons-dbcp requires org.apache.commons.pool package (between version 1.3.0 and 2.0.0).
If we take a look on commons-pool bundle details:
karaf@root()> obr:info org.apache.servicemix.bundles.commons-pool -------------------------------------------- Apache ServiceMix :: Bundles :: commons-pool -------------------------------------------- id: org.apache.servicemix.bundles.commons-pool/1.5.4.3 description: This OSGi bundle wraps commons-pool 1.5.4 jar file. documentation: http://www.apache.org/ symbolicname: org.apache.servicemix.bundles.commons-pool presentationname: Apache ServiceMix :: Bundles :: commons-pool license: http://www.apache.org/licenses/LICENSE-2.0.txt uri: file:/home/jbonofre/apache-karaf-3.0.1/cave/my-repository/org.apache.servicemix.bundles.commons-pool-1.5.4.3.jar size: 97332 version: 1.5.4.3 Capabilities: bundle:{manifestversion=2, symbolicname=org.apache.servicemix.bundles.commons-pool, presentationname=Apache ServiceMix :: Bundles :: commons-pool, version=1.5.4.3} package:{package=org.apache.commons.pool.impl, uses:=org.apache.commons.pool, version=1.5.4} package:{package=org.apache.commons.pool, version=1.5.4}
This bundle provides package org.apache.commons.pool capability.
It means that if I deploy the commons-dbcp bundle, the OBR should also install the commons-pool bundle:
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.
Done: the OBR has resolved the commons-dbcp requirements using the commons-pool capabilities and so installed the commons-pool bundle.
Note
|
In the |