Package org.nuxeo.runtime.osgi
Class OSGiRuntimeService
java.lang.Object
org.nuxeo.runtime.AbstractRuntimeService
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.nuxeo.runtime.AbstractRuntimeService
AbstractRuntimeService.LogConfig
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ComponentName
static final String
static final String
The OSGi application config directory.static final String
Can be used to change the runtime home directorystatic final String
The host adapter.static final String
The OSGi application install directory.static final String
protected static final Comparator<String>
static final Version
Fields inherited from class org.nuxeo.runtime.AbstractRuntimeService
context, isShuttingDown, isStarted, logConfig, manager, messageHandler, properties, REDIRECT_JUL, REDIRECT_JUL_THRESHOLD, workingDir
-
Constructor Summary
ConstructorDescriptionOSGiRuntimeService
(OSGiRuntimeContext runtimeContext, org.osgi.framework.BundleContext context) OSGiRuntimeService
(org.osgi.framework.BundleContext context) -
Method Summary
Modifier and TypeMethodDescriptioncreateContext
(org.osgi.framework.Bundle bundle) protected void
void
destroyContext
(org.osgi.framework.Bundle bundle) protected void
doStart()
protected void
doStop()
expandVars
(String expression) Overrides the default method to be able to include OSGi properties.org.osgi.framework.Bundle
findHostBundle
(org.osgi.framework.Bundle bundle) void
frameworkEvent
(org.osgi.framework.FrameworkEvent event) org.osgi.framework.Bundle
Get an installed bundle given its symbolic name.org.osgi.framework.BundleContext
getBundleFile
(org.osgi.framework.Bundle bundle) OSGi frameworks are using a stringBundle.getLocation()
to identify bundle locations.static String
getComponentsList
(org.osgi.framework.Bundle bundle) getContext
(String symbolicName) getContext
(org.osgi.framework.Bundle bundle) getName()
Gets the name of this runtime service.getProperty
(String name, String defValue) Overrides the default method to be able to include OSGi properties.Gets the version of this runtime service.static boolean
isJBoss4
(Environment env) protected static boolean
isPropertiesFile
(String name) protected void
loadComponents
(org.osgi.framework.Bundle bundle, RuntimeContext ctx, boolean isFragment) protected void
protected boolean
protected void
Loads default properties.void
loadProperties
(File file) void
Deprecated, for removal: This API element is subject to removal in a future version.void
loadProperties
(Reader reader) void
loadProperties
(URL url) void
Reread all property files loaded at startup.protected void
Methods inherited from class org.nuxeo.runtime.AbstractRuntimeService
createComponentManager, getBuiltinFeatureURL, getComponent, getComponentInstance, getComponentManager, getContext, getDescription, getErrorLoggerThread, getHome, getMessageHandler, getProperties, getProperty, getService, getStatusMessage, isShuttingDown, isStarted, setHome, setProperty, start, stop, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.RuntimeService
getComponent, getComponentInstance
-
Field Details
-
FRAMEWORK_STARTED_COMP
-
PROP_HOME_DIR
Can be used to change the runtime home directory- See Also:
-
PROP_INSTALL_DIR
The OSGi application install directory.- See Also:
-
PROP_CONFIG_DIR
The OSGi application config directory.- See Also:
-
PROP_HOST_ADAPTER
The host adapter.- See Also:
-
PROP_NUXEO_BIND_ADDRESS
- See Also:
-
NAME
- See Also:
-
VERSION
-
PROPERTIES_FILE_FIRST
-
-
Constructor Details
-
OSGiRuntimeService
public OSGiRuntimeService(org.osgi.framework.BundleContext context) -
OSGiRuntimeService
public OSGiRuntimeService(OSGiRuntimeContext runtimeContext, org.osgi.framework.BundleContext context)
-
-
Method Details
-
getName
Description copied from interface:RuntimeService
Gets the name of this runtime service.- Specified by:
getName
in interfaceRuntimeService
- Returns:
- the runtime service name
-
getVersion
Description copied from interface:RuntimeService
Gets the version of this runtime service.- Specified by:
getVersion
in interfaceRuntimeService
- Returns:
- the runtime service version
-
getBundleContext
public org.osgi.framework.BundleContext getBundleContext() -
getBundle
Description copied from interface:RuntimeService
Get an installed bundle given its symbolic name. This method is not handling versions.- Specified by:
getBundle
in interfaceRuntimeService
- Overrides:
getBundle
in classAbstractRuntimeService
-
getBundlesMap
-
getComponentPersistence
-
createContext
-
destroyContext
public void destroyContext(org.osgi.framework.Bundle bundle) -
getContext
-
getContext
-
doStart
protected void doStart()- Overrides:
doStart
in classAbstractRuntimeService
-
doStop
protected void doStop()- Overrides:
doStop
in classAbstractRuntimeService
-
loadComponents
protected void loadComponents(org.osgi.framework.Bundle bundle, RuntimeContext ctx, boolean isFragment) -
getComponentsList
-
loadConfigurationFromProvider
- Throws:
IOException
-
loadConfig
- Overrides:
loadConfig
in classAbstractRuntimeService
- Throws:
IOException
-
reloadProperties
Description copied from interface:RuntimeService
Reread all property files loaded at startup.- Specified by:
reloadProperties
in interfaceRuntimeService
- Throws:
IOException
-
loadDefaultConfig
protected void loadDefaultConfig()Loads default properties.Used for backward compatibility when adding new mandatory properties
-
loadProperties
- Throws:
IOException
-
loadProperties
- Throws:
IOException
-
loadProperties
@Deprecated(since="2025.0", forRemoval=true) public void loadProperties(InputStream in) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.since 2025.0,Properties.load(InputStream)
loads properties with ISO-8859-1 encoding whereas we want UTF-8, useloadProperties(Reader)
instead- Throws:
IOException
-
loadProperties
- Throws:
IOException
-
getProperty
Overrides the default method to be able to include OSGi properties.- Specified by:
getProperty
in interfaceRuntimeService
- Overrides:
getProperty
in classAbstractRuntimeService
- Parameters:
name
- the property namedefValue
- the default value to use when the property doesn't exists- Returns:
- the property value
-
expandVars
Overrides the default method to be able to include OSGi properties.- Specified by:
expandVars
in interfaceRuntimeService
- Overrides:
expandVars
in classAbstractRuntimeService
- Parameters:
expression
- the expression to process- Returns:
- the expanded expression
-
startComponents
protected void startComponents() -
frameworkEvent
public void frameworkEvent(org.osgi.framework.FrameworkEvent event) - Specified by:
frameworkEvent
in interfaceorg.osgi.framework.FrameworkListener
-
deployFrameworkStartedComponent
protected void deployFrameworkStartedComponent() -
findHostBundle
public org.osgi.framework.Bundle findHostBundle(org.osgi.framework.Bundle bundle) -
getBundleFile
Description copied from interface:RuntimeService
OSGi frameworks are using a stringBundle.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 interfaceRuntimeService
- Overrides:
getBundleFile
in classAbstractRuntimeService
- Returns:
- the bundle file, or null
-
isJBoss4
-
isPropertiesFile
-
Properties.load(InputStream)
loads properties with ISO-8859-1 encoding whereas we want UTF-8, useloadProperties(Reader)
instead