DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
Overview
The Felix OSGi framework is intended to be easily launchable and embeddable. For example, Felix avoids the use of system properties for configuration, since these are globals that can cause interference if multiple framework instances are created in the same VM. Felix is also implemented to multiplex singleton facilities, like the URL stream handler factory. The goal is to make it possible to use Felix in as many scenarios as possible; however, this is still just a goal. In other words, this is a work in progress and if any issues arise, it would be greatly appreciated if they are brought to the attention of the Felix community.
This document is divided into two main sections, one focusing on how to launch Felix and one focusing on how to embed Felix into a host application.
Launching Felix
High-level abstract description to go here.
Standard Felix Launcher
Sufficiently detailed description of the standard Felix launcher to go here.
Custom Felix Launcher
This section creates a bare-bones launcher to demonstrate the minimum requirements for creating an interactive launcher for the Felix framework. This example uses the standard Felix shell bundles for interactivity, but any other bundles could be used too. For example, the shell and telnet bundles could be used to lauch Felix and make it remotely accessible.
This example launcher has the following directory structure:
bundle/
org.apache.felix.shell-0.8.0-SNAPSHOT.jar
org.apache.felix.shell.tui-0.8.0-SNAPSHOT.jar
lib/
org.apache.felix.framework-0.8.0-SNAPSHOT.jar
org.osgi.core-0.8.0-SNAPSHOT.jar
src/
example/
Main.java
package example;
import java.util.Map;
import org.apache.felix.framework.Felix;
import org.apache.felix.framework.cache.BundleCache;
import org.apache.felix.framework.util.MutablePropertyResolverImpl;
import org.apache.felix.framework.util.StringMap;
import org.apache.felix.framework.util.FelixConstants;
public class Main
{
private static Felix m_felix = null;
public static void main(String[] argv) throws Exception
{
// Print welcome banner.
System.out.println("\nWelcome to Felix.");
System.out.println("=================\n");
Map configMap = new StringMap(false);
configMap.put(FelixConstants.FRAMEWORK_SYSTEMPACKAGES,
"org.osgi.framework; version=1.3.0," +
"org.osgi.service.packageadmin; version=1.2.0," +
"org.osgi.service.startlevel; version=1.0.0," +
"org.osgi.service.url; version=1.0.0");
configMap.put(FelixConstants.AUTO_START_PROP + ".1",
"file:bundle/org.apache.felix.shell-0.8.0-SNAPSHOT.jar " +
"file:bundle/org.apache.felix.shell.tui-0.8.0-SNAPSHOT.jar");
configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "cache");
try
{
// Now create an instance of the framework.
m_felix = new Felix();
m_felix.start(
new MutablePropertyResolverImpl(configMap),
null);
}
catch (Exception ex)
{
System.err.println("Could not create framework: " + ex);
ex.printStackTrace();
System.exit(-1);
}
}
}
Embedding Felix
to do
Host/Felix Interaction
to do
Providing Host Application Services
to do
Using Services Provided by Bundles
to do