Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.runtime.osgi
Class OSGiRuntimeService

java.lang.Object
  extended by org.nuxeo.runtime.AbstractRuntimeService
      extended by org.nuxeo.runtime.osgi.OSGiRuntimeService
All Implemented Interfaces:
EventListener, RuntimeService, org.osgi.framework.FrameworkListener
Direct Known Subclasses:
OSGiRuntimeTestService

public class OSGiRuntimeService
extends AbstractRuntimeService
implements org.osgi.framework.FrameworkListener

The default implementation of NXRuntime over an OSGi compatible environment.

Author:
Bogdan Stefanescu, Florent Guillaume

Field Summary
static ComponentName FRAMEWORK_STARTED_COMP
           
static String NAME
           
static String PROP_CONFIG_DIR
          The OSGi application config directory.
static String PROP_HOME_DIR
          Can be used to change the runtime home directory
static String PROP_HOST_ADAPTER
          The host adapter.
static String PROP_INSTALL_DIR
          The OSGi application install directory.
static String PROP_NUXEO_BIND_ADDRESS
           
static Version VERSION
           
 
Fields inherited from class org.nuxeo.runtime.AbstractRuntimeService
REDIRECT_JUL, REDIRECT_JUL_THRESHOLD
 
Constructor Summary
OSGiRuntimeService(org.osgi.framework.BundleContext context)
           
OSGiRuntimeService(OSGiRuntimeContext runtimeContext, org.osgi.framework.BundleContext context)
           
 
Method Summary
 RuntimeContext createContext(org.osgi.framework.Bundle bundle)
           
 void destroyContext(org.osgi.framework.Bundle bundle)
           
 org.osgi.framework.Bundle findHostBundle(org.osgi.framework.Bundle bundle)
           
 void fireApplicationStarted()
           
 void frameworkEvent(org.osgi.framework.FrameworkEvent event)
           
 org.osgi.framework.Bundle getBundle(String symbolicName)
          Get an installed bundle given its symbolic name.
 org.osgi.framework.BundleContext getBundleContext()
           
 File getBundleFile(org.osgi.framework.Bundle bundle)
          OSGi frameworks are using a string Bundle.getLocation() to identify bundle locations.
 Map<String,org.osgi.framework.Bundle> getBundlesMap()
           
 ComponentPersistence getComponentPersistence()
           
static String getComponentsList(org.osgi.framework.Bundle bundle)
           
 RuntimeContext getContext(org.osgi.framework.Bundle bundle)
           
 RuntimeContext getContext(String symbolicName)
           
 String getName()
          Gets the name of this runtime service.
 String getProperty(String name, String defValue)
          Overrides the default method to be able to include OSGi properties.
 boolean getStatusMessage(StringBuilder msg)
           
 Version getVersion()
          Gets the version of this runtime service.
static boolean isJBoss4(Environment env)
           
 void loadProperties(File file)
           
 void loadProperties(InputStream in)
           
 void loadProperties(URL url)
           
 void reloadProperties()
          Reread all property files loaded at startup.
 
Methods inherited from class org.nuxeo.runtime.AbstractRuntimeService
expandVars, getComponent, getComponent, getComponentInstance, getComponentInstance, getComponentManager, getContext, getDescription, getHome, getProperties, getProperty, getService, getWarnings, isShuttingDown, isStarted, setHome, setProperty, start, stop, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FRAMEWORK_STARTED_COMP

public static final ComponentName FRAMEWORK_STARTED_COMP

PROP_HOME_DIR

public static final String PROP_HOME_DIR
Can be used to change the runtime home directory

See Also:
Constant Field Values

PROP_INSTALL_DIR

public static final String PROP_INSTALL_DIR
The OSGi application install directory.

See Also:
Constant Field Values

PROP_CONFIG_DIR

public static final String PROP_CONFIG_DIR
The OSGi application config directory.

See Also:
Constant Field Values

PROP_HOST_ADAPTER

public static final String PROP_HOST_ADAPTER
The host adapter.

See Also:
Constant Field Values

PROP_NUXEO_BIND_ADDRESS

public static final String PROP_NUXEO_BIND_ADDRESS
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

VERSION

public static final Version VERSION
Constructor Detail

OSGiRuntimeService

public OSGiRuntimeService(org.osgi.framework.BundleContext context)

OSGiRuntimeService

public OSGiRuntimeService(OSGiRuntimeContext runtimeContext,
                          org.osgi.framework.BundleContext context)
Method Detail

getName

public String getName()
Description copied from interface: RuntimeService
Gets the name of this runtime service.

Specified by:
getName in interface RuntimeService
Returns:
the runtime service name

getVersion

public Version getVersion()
Description copied from interface: RuntimeService
Gets the version of this runtime service.

Specified by:
getVersion in interface RuntimeService
Returns:
the runtime service version

getBundleContext

public org.osgi.framework.BundleContext getBundleContext()

getBundle

public org.osgi.framework.Bundle getBundle(String symbolicName)
Description copied from interface: RuntimeService
Get an installed bundle given its symbolic name. This method is not handling versions.

Specified by:
getBundle in interface RuntimeService
Overrides:
getBundle in class AbstractRuntimeService
Returns:

getBundlesMap

public Map<String,org.osgi.framework.Bundle> getBundlesMap()

getComponentPersistence

public ComponentPersistence getComponentPersistence()

createContext

public RuntimeContext createContext(org.osgi.framework.Bundle bundle)
                             throws Exception
Throws:
Exception

destroyContext

public void destroyContext(org.osgi.framework.Bundle bundle)

getContext

public RuntimeContext getContext(org.osgi.framework.Bundle bundle)

getContext

public RuntimeContext getContext(String symbolicName)

getComponentsList

public static String getComponentsList(org.osgi.framework.Bundle bundle)

reloadProperties

public void reloadProperties()
                      throws Exception
Description copied from interface: RuntimeService
Reread all property files loaded at startup.

Specified by:
reloadProperties in interface RuntimeService
Throws:
Exception

loadProperties

public void loadProperties(File file)
                    throws IOException
Throws:
IOException

loadProperties

public void loadProperties(URL url)
                    throws IOException
Throws:
IOException

loadProperties

public void loadProperties(InputStream in)
                    throws IOException
Throws:
IOException

getProperty

public String getProperty(String name,
                          String defValue)
Overrides the default method to be able to include OSGi properties.

Specified by:
getProperty in interface RuntimeService
Overrides:
getProperty in class AbstractRuntimeService
Parameters:
name - the property name
defValue - the default value to use when the property doesn't exists
Returns:
the property value

fireApplicationStarted

public void fireApplicationStarted()

frameworkEvent

public void frameworkEvent(org.osgi.framework.FrameworkEvent event)
Specified by:
frameworkEvent in interface org.osgi.framework.FrameworkListener

getStatusMessage

public boolean getStatusMessage(StringBuilder msg)
Parameters:
msg - summary message about all components loading status
Returns:
true if there was no detected error, else return false
Since:
5.4.3

findHostBundle

public org.osgi.framework.Bundle findHostBundle(org.osgi.framework.Bundle bundle)

getBundleFile

public File getBundleFile(org.osgi.framework.Bundle bundle)
Description copied from interface: RuntimeService
OSGi frameworks are using a string Bundle.getLocation() to identify bundle locations.

This method try to convert the bundle location to real file if possible. If this bundle location cannot be converted to a file (e.g. it may be a remote URL), null is returned.

This method works only for bundles that are installed as files on the host file system.

Specified by:
getBundleFile in interface RuntimeService
Overrides:
getBundleFile in class AbstractRuntimeService
Returns:
the bundle file, or null

isJBoss4

public static final boolean isJBoss4(Environment env)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.