from: http://aniketos.eu/content/easy-installation-bundles-apache-karaf
Apache Karaf provides many convenient ways for bundles installation:
- Use of the install command in Karaf's command prompt
- Copying of bundles to the deploy directory
- Use of Apache Karaf features
From these three alternatives Karaf features seems to be the most advantageus. It allows the installation and uninstallation of many bundles in one go. No bundles will be installed, if there is a problem even with a single one. This helps you keep a clean container and spot errors easier. It supports mvn, http and file protocols making the installation of bundles from different locations easier. Last, but not least, it can also install non-OSGi jars (jars without an OGSi manifest), with the aid of the wrap protocol.
In a previous post about Spring-JDBC in an OSGi environment the usage of Karaf features with the Maven protocol was presented. A features.xml file pointing to bundles in Maven repositories was created. The features.xml file was hosted by a Maven project, making it possible to add a features Maven URL in Karaf.
However bundles are not always available in Maven repositories. Sometimes all you have is a zip file with all necessary jars or some HTTP URLs. This is especially true in Aniketos project, where there are contributions from many partners, using both Maven and Eclipse RCP for development and there is also some legacy code involved. In these cases Apache Karaf are still useful.
This is an example of a features.xml file that points to jar files in the local file system:
<features> <feature name='greeter_server' version='1.0'> <bundle>file:///c:/Tools/Aniketos/bundles/common/org.osgi.compendium-4.2.0.jar</bundle> <bundle>file:///c:/Tools/Aniketos/bundles/greeter_sample/cxf-dosgi-ri-singlebundle-distribution-1.3.1.jar</bundle> <bundle>file:///c:/Tools/Aniketos/bundles/greeter_sample/cxf-dosgi-ri-samples-greeter-interface-1.3.1.jar</bundle> <bundle>file:///c:/Tools/Aniketos/bundles/greeter_sample/cxf-dosgi-ri-samples-greeter-client-1.3.1.jar</bundle> </feature> </features>
These can easily be installed in one go:
karaf@root> features:addURl file:///path/to/features.xml karaf@root> features:install greeter_server
If you modify one of the jar files and you want to re-install, then you can use:
karaf@root> features:uninstall greeter_server karaf@root> features:install greeter_server
If you want to remove or add a jar file in the features.xml file, then you can refresh the URL:
karaf@root> features:refreshURl file:///path/to/features.xml karaf@root> features:install greeter_server
In another post I am going to explain how the wrap protocol supported by Karaf can help in certain situations.
相关推荐
Learning Apache Karaf will help guide you through the complexity of an OSGi container using sample code and configuration snippets to demonstrate the important aspects of managing and running a Karaf ...
org.apache.servicemix.bundles.xmlbeans-2.4.0_1.jar
gooddata-http-client.zip,能够处理gooddata身份验证的http客户端处理gooddata身份验证的专用java客户端
论文《Authentication Tests and the Structure of Bundles》
servicemix-bundles:Apache ServiceMix捆绑包的镜像
mysql-binlog-connector-java.zip,mysql二进制日志连接器mysql二进制日志连接器
smaller-dev-server.zip,一个开发服务器,利用较小的程序为本地
配置说明可以参考本人博客: http://blog.csdn.net/crazyingBird/archive/2011/06/22/6561987.aspx
embedly-java.zip,用于api的嵌入式客户端库和用于embed.ly api的projava客户端
minify-maven-plugin.zip,合并和最小化javascript和css文件以加快页面加载速度。合并和最小化javascript和css文件以加快页面加载速度。
stackable-controller.zip,Play2.x的可堆叠控制器可压缩动作组合框架
android-constrained-widgets.zip,android小部件的android set的一组宽高比受限小部件,它将遵守给定的宽高比
ASP.NET MVC Bundles 脚本包使用 ASP.NET MVC Bundles 脚本包使用 ASP.NET MVC Bundles 脚本包使用 ASP.NET MVC Bundles 脚本包使用 ASP.NET MVC Bundles 脚本包使用
Laravel开发-bundles Laravel束
In a service oriented architecture, applications consist of several cooperating services. These networks of services are often dynamic in nature, so managing dependencies is something the developer ...
这个压缩包里有apache poi技术所使用的的jar包 包括:commons-beanutils-1.8.0.jar,commons-collections-3.2.jar,commons-io-2.2.jar,org.apache.servicemix.bundles.dom4j-2.1.1_1.jar,poi-3.9.jar,poi-ooxml-...
精益实践和企业运营绩效:基于运营吸收能力的调节作用,吴聪,牛占文,精益与运营绩效(OP)之间的关系在现有文献中被广泛研究。但精益实践是否确实对运营绩效起到正向作用并未明确。诸多学者将导致该�
In order to guard against corrupted downloads/installations, it is highly recommended to verify the signature of the release bundles against the public KEYS used by the Apache Maven developers.
kiln-java-adaptor.zip,回转窑测井服务适配器回转窑测井服务适配器