Karaf relies on Equinox and Felix,karaf many of the Apache projects as the foundation framework

Source: Internet
Author: User
Tags maven central

June 17 is Apache Karaf as Apache top project. Karaf is a run-time package that contains an OSGI framework (Equinox or Felix), a command shell (Felix Gogo), and a number of utilities built into it by default.

Although Equinox and Felix can be used alone, the KARAF is designed to combine the excellent OSGI capabilities of both frameworks and ensure that they are out of the box. For example, it contains a configurable log system (based on log4j, but is packaged for many common logging systems), remote access via SSH, configuration via configadmin (source code in the ETC directory), and built-in Jaas support. Not only that, Karaf also installs the Pax URL's MVN protocol, which allows the bundle to be installed from the MAVEN central repository (which is automatically packaged as bundles if necessary).

In addition, KARAF proposes the concept of a feature, which is a collection of bundles that can be installed as a group into the running OSGi runtime. Features include support for the OBR, jetty, and spring, which is available out of the box. That way, if you need to install multiple bundles, but there is no strict run-time dependency between these bundles, this kind of support can be greatly simplified.

Before migrating to the Apache Felix Project, Karaf was ServiceMix Kernel and eventually became the top project of Apache. Karaf is also part of other frameworks, such as Eclipse Virgo and Eclipsert packages, which provide preconfigured frameworks and easy-to-use OSGi bundles, which makes it easier than ever to get started with OSGi runtime.

Http://felix.apache.org/downloads.cgi#framework

Http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/bundles/org.eclipse.osgi

Karaf as a mature and excellent OSGi operating environment and container has been a lot of Apache projects as a base container, such as: Apache Geronimo, Apacheservicemix, Fuse ESB, this shows Karaf in performance, It is a good choice for both function and stability.

The Karf is analyzed from four aspects, which are KARAF environment variable, starting level, new concept and core technology appearing in Karaf.

Karaf involves two environment variables, the Karaf_home and Karaf_base,karaf_home directories are the required files for the boot Karaf, and the directory structure is as follows:
The Lib directory contains three files, Karaf.jar, Karaf-client.jar, and Karaf-jaas-boot.jar, which are added to Karaf classpath by default.
The ETC directory mainly contains the selection configuration of the OSGi framework, such as what OSGi framework implementation is used.
The system directory contains the OSGi framework implementation jar packages implemented by Eclipse and Felix.

The KARAF has 6 boot levels, 5, 8, 10, 15, 30, 40, respectively. The order in which they are started is to start with a small number first.

    • Level 5 contains the MVN protocol and the Wrap protocol that comply with the OSGi URL handlers Service Specification (11th chapter of the OSGi Core specification).
    • Level 8, including log adapters (including log4j,slf4j,commons-logging, etc.) and log services.
    • Level 10, including the specification API, Configuration Management Service (104), User Preference Service (106).
    • Level 15, including the thermal deployer.
    • 30 levels, including Gshell, Spring DM, JMX and so on.
    • Level 40, which contains the initiator of the Gshell, Gshell converted to a usable state when running to this level.

Karaf set two default levels, 60 and 100,60, which means that when an external application is deployed to Karaf, Karaf will set the application's startup level to 60;100 by default when Karaf starts to level 100. That is, all bundles below 100 will be started.
The concept of feature is referenced in Karaf. Feature is a deployment descriptor for a bundle set that conforms to a feature, as shown in the following configuration file:

XML code
  1. <features>
  2. <repository>urn:r1</repository>
  3. <feature name="F1">
  4. <config name="C1">
  5. k=v
  6. </config>
  7. <bundle>b1</bundle>
  8. <bundle>b2</bundle>
  9. </feature>
  10. <feature name="F2">
  11. <feature>f1</feature>
  12. <bundle>b3</bundle>
  13. </feature>
  14. </features>


The KRARF can be statically switched to the OSGi framework implementation, which is implemented as follows:

      1. To get the relative path of the OSGi implementation jar package from the configuration file
      2. Use the reflection mechanism to add this jar package to the current ClassLoader
      3. Read the/meta-inf/services/org.osgi.framework.launch.frameworkfactory file to get the Frameworkfactory implementation class name
      4. Instantiate this class with a reflection mechanism and create a framework instance and start

Karaf relies on Equinox and Felix,karaf many of the Apache projects as the foundation framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.