Page tree
Skip to end of metadata
Go to start of metadata

OSGi bundles

The DPUs developed are provided to the UnifiedViews in the form of OSGi bundles. The OSGI can be view as the dependency management system. Bundle is a jar file with additional informations in MANIFEST.MF. The advantage of using OSGi bundles instead of simple JAR archives is that OSGi supports dynamic loadings of JAR files with their dependency resolving - OSGI uses information in jar's MANIFEST.MF to identify the dependencies of the bundle. Also every DPU may use its own set of dependencies (JAR libraries), which are hidden to other DPUs, thus, two DPUs may use two conflicting dependencies at once.

Each OSGi bundle contains maninifest.mf file located in the bundle, META-INF folder. This files contains bundle description. The most important part contains settings for exported and imported packages. The Export-Package is the list of packages provided by the bundle while the Import-Package is the list of packages that the bundle requires from others to export in order to work properly. Sample of this part is as follows:

  
Export-Package: cz.cuni.mff.xrg.odcs.loader.rdf
Import-Package: com.vaadin.data,com.vaadin.data.util,com.vaadin.server,com.vaadin.shared.ui.combobox,com.vaadin.ui,cz.cuni.mff.xrg.odcs.commons.configuration;version="0.0.1",cz.cuni.mff.xrg.odcs.commons.data;version="0.0.1",cz.cuni.mff.xrg.odcs.commons.loader;version="0.0.1",cz.cuni.xrg.int lib.commons.module.data;version="0.0.1",cz.cuni.mff.xrg.odcs.commons.modu le.dialog;version="0.0.1",cz.cuni.mff.xrg.odcs.commons.module.dpu;version="0.0.1",cz.cuni.mff.xrg.odcs.commons.web;version="0.0.1",cz.cuni.xrg.int lib.rdf.enums,cz.cuni.mff.xrg.odcs.rdf.exceptions,cz.cuni.mff.xrg.odcs.rdf.interfaces

The Export-Package configuration option specifies packages that the DPU bundle provides to the external environment (UnifiedViews). On the other hand Import-Package configuration option lists dependencies of the bundle -- the packages that the bundle requires from others. As a result, such dependencies MUST be provide by the external environment (UnifiedViews) before the DPU is used. Dependencies are specified as packages, not JAR archives or classes in the maninifest.mf file.

Manifest file maninifest.mf also contains lines with DPU-MainClass and DPU-Package that are essential for bundle use. DPU-MainClass contains name of the main class of the DPU which is called when the DPU is executed on the pipeline.DPU-Package contains name of the package in which the main class is located.

Maven

Apache Maven is a software project management and comprehension tool. The created DPUs are suggested to be maven projects, so that DPU bundles can be easily managed and created. In order to set up maven in your system, please follow this site

TODO describe the minimum install - local repository

TODO describe the work with dependencies, scopes - compile, ..

Pom.xml file is the basic configuration file needed when the maven project is being build. If you want to add dependency to the project (DPU bundle), pom.xml is the right place. See the sample pom.xml for SPARQL transformer

Why you should use preimplemented abstract classes and not interfaces, if these classes fit your needs?

The preimplemented classes contains default implementation for optionally implemented methods. This is why their usage can made DPU's code simpler and also allows DPU's developer to focus directly on implementation of DPU's executive functionality. 
The other great advantage is easier switch to the newer UnifiedViews version. If a new method will be introduced in the base interface then if possible default implementation will be provided in respective preimplements class. Thanks to that the DPU's code itself does not have to change. The DPU can be directly recompiled with latest UnifiedViews version and it's readily to be used.

  • No labels