`

Easy installation of bundles in Apache Karaf

 
阅读更多

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

    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 ...

    apache karaf 2.3 用户手册(中文版)

    Apache Karaf是一款轻量级的服务平台,基于OSGi标准,用于构建、部署和管理Java应用程序。它是Apache ServiceMix项目的一部分,被广泛应用于企业级Java应用的开发和运行环境。Apache Karaf 2.3是其特定的一个版本,...

    Apache Karaf User's Guide 2.2.8

    Apache Karaf用户指南2.2.8版是针对Apache Karaf这一开源OSGi运行时环境的用户手册。Karaf提供了一个轻量级容器,用于部署各种组件和应用程序。以下是手册中涉及的一些关键知识点: 1. **热部署**:Karaf支持热部署...

    learning-apache-karaf:学习Apache Karaf,书籍源代码-apache source code

    3. **Karaf部署与运行**:学习如何安装和启动Karaf,创建和管理OSGi bundles,以及如何通过Karaf的命令行工具进行操作,如部署、启动、停止和更新bundle。 4. **Karaf特性**:了解Karaf的特性,如Features(特性集...

    karaf cxf

    - 在 Karaf 控制台输入命令 `feature:repo-add mvn:org.apache.cxf.karaf/apache-cxf/xx.xx.xx/xml/features`,其中 `xx.xx.xx` 需替换为实际的 CXF 版本号。 2. **查看 Feature Repositories**: - 输入命令 `...

    org.apache.servicemix.bundles.elasticsearch-1.0.1_1.zip

    标题中的"org.apache.servicemix.bundles.elasticsearch-1.0.1_1.zip"表明这是一个与Apache ServiceMix相关的软件包,特别地,它包含了Elasticsearch的一个特定版本(1.0.1)的bundle。Apache ServiceMix是基于Java...

    servicemix-bundles:Apache ServiceMix捆绑包的镜像

    在"servicemix-bundles-master"这个压缩包中,很可能是包含了Apache ServiceMix所有核心捆绑包的源码或者构建版本。开发者可以通过分析和修改这些捆绑包来定制自己的ServiceMix环境,以满足特定项目的需求。 总的来...

    org.apache.servicemix.bundles.xmlbeans-2.4.0_1.jar

    org.apache.servicemix.bundles.xmlbeans-2.4.0_1.jar

    org.apache.servicemix.bundles.spring-jdbc-4.0.2.RELEASE_1.zip

    【标题】"Apache ServiceMix Bundles - Spring JDBC 4.0.2.RELEASE_1" Apache ServiceMix 是一个全面的企业级服务导向架构(SOA)平台,它基于Java语言和OSGi规范。这个压缩包“org.apache.servicemix.bundles....

    org.apache.servicemix.bundles.spring-jdbc-3.2.8.RELEASE_2.zip

    标题 "org.apache.servicemix.bundles.spring-jdbc-3.2.8.RELEASE_2.zip" 提供的信息表明,这个压缩包包含了 Apache ServiceMix 的一个捆绑包,具体是 Spring JDBC 模块的 3.2.8.RELEASE 版本的第二次更新。Apache ...

    gtk+ All-in-one bundles

    All-in-one bundles是指将GTK+的完整集合打包在一起,包括库、开发工具和其他相关组件,方便开发者进行一站式下载和安装。 标题中的"gtk+ All-in-one bundles"暗示我们这里讨论的是一个包含所有GTK+组件的综合包。...

    org.apache.servicemix.bundles.spring-beans-3.2.7.RELEASE_1.zip

    smaller-dev-server.zip,一个开发服务器,利用较小的程序为本地

    org.apache.servicemix.bundles.spring-aspects-3.2.8.RELEASE_2.zip

    标题中的"org.apache.servicemix.bundles.spring-aspects-3.2.8.RELEASE_2.zip"指示了这是一个与Apache ServiceMix相关的软件包,特别地,它包含了Spring框架的一个特定版本——3.2.8.RELEASE的面向切面编程(AOP)...

    org.apache.servicemix.bundles.spring-test-3.2.8.RELEASE_2.zip

    标题中的"org.apache.servicemix.bundles.spring-test-3.2.8.RELEASE_2.zip"表明这是一个关于Apache ServiceMix的Spring测试框架的版本包。Apache ServiceMix是基于Java的全面企业级服务总线(ESB),它集成了许多...

    Apache POI 所有 jar 下载

    Apache POI是Apache软件基金会提供的100%开源库。大多数中小规模的应用程序开发主要依赖于Apache POI(HSSF+ XSSF)。它支持Excel 库的所有基本功能; 然而,呈现和文本提取是它的主要特点。

    论文《Authentication Tests and the Structure of Bundles》

    捆绑结构(Bundles)** - **定义**:在密码学协议中,多个消息或操作可能被组合成一组,称为“捆绑”。捆绑可以被视为一系列操作或消息的集合。 - **作用**:通过分析捆绑结构,可以更好地理解协议的行为和安全性...

    org.apache.servicemix.bundles.aws-java-sdk-1.4.1_1.zip

    embedly-java.zip,用于api的嵌入式客户端库和用于embed.ly api的projava客户端

    Laravel开发-bundles

    在Laravel框架中,"Bundles"是早期版本(主要在Laravel 3)中用于组织和管理应用程序组件的一种方式。然而,在Laravel 4及其后续版本中,Bundles的概念被弃用,取而代之的是更现代的包管理机制,如服务提供者...

Global site tag (gtag.js) - Google Analytics