public class FelixOsgiHost extends BaseOsgiHost
struts.osgi.clearBundleCache: Defaults to "true" delete installed bundles when the container starts
struts.osgi.logLevel: Defaults to "1". Felix log level. 1 = error, 2 = warning, 3 = information, and 4 = debug
struts.osgi.runLevel: Defaults to "3". Run level to start the container.
struts.osgi.felixCacheLocking: Defaults to "true". Set to true to enable Felix cache locking, false to disable it.
struts.osgi.searchForPropertiesFilesInRelativePath: Defaults to "false". Set to "true" for fallback search for properties files in relative path (e.g. for unit testing).
struts.osgi.felixPropertiesPath: Defaults to "default.properties". Path to Felix properties (prefix "/" will be prepended).
struts.osgi.strutsOSGiPropertiesPath: Defaults to "struts-osgi.properties". Path to Struts OSGi properties (prefix "/" will be prepended).
Modifier and Type | Field and Description |
---|---|
protected org.apache.felix.framework.Felix |
felix |
protected static String |
FELIX_DETECT_JAVA_VERSION |
protected static String |
FELIX_EE_CAP_DETECT_JPMS |
protected static String |
FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION |
protected static String |
FELIX_EE_FELIX_DETECT_JPMS |
protected static String |
FELIX_EE_JAVA_SPECIFICATION_VERSION |
protected static String |
FELIX_JRE_BASE_PREFIX |
protected static String |
FELIX_JRE_BASE_SUFFIX |
protected static String |
FELIX_JRE_DETECT_JAVA_SPECIFICATION_VERSION |
protected static String |
FELIX_JRE_DETECT_JPMS |
protected static String |
FELIX_SERVICE_CAPS |
protected static String |
FELIX_SERVICE_CAPS_KEY |
protected static String |
OSGI_FRAMEWORK_EXECUTIONENVIRONMENT |
protected static String |
OSGI_FRAMEWORK_SYSTEM_CAPABILITIES |
DETECT_JAVA_VERSION, JRE_JAVA_SPECIFICATION_VERSION, SCANNING_PACKAGE_INCLUDES, servletContext, VERSION_PATTERN, versionPattern
OSGI_BUNDLE_CONTEXT, OSGI_HEADER_STRUTS_ENABLED
Constructor and Description |
---|
FelixOsgiHost() |
Modifier and Type | Method and Description |
---|---|
protected void |
addSpringOSGiSupport() |
void |
destroy() |
protected String |
expandAllFelixJREBaseElements(String jreProperty,
Properties properties)
Recursive method to expand all Felix JRE base elements from the configuration.
|
protected String |
expandAllOsgiFrameworkExecutionEnvironments(String executionEnvironment,
Properties properties)
Method to expand all OSGi framework execution environment elements from the configuration.
|
protected String |
expandAllOsgiFrameworkSystemCapabilities(String capabilities,
Properties properties)
Method to expand all OSGi framework system capabilities elements from the configuration.
|
Map<String,org.osgi.framework.Bundle> |
getActiveBundles() |
org.osgi.framework.BundleContext |
getBundleContext() |
Map<String,org.osgi.framework.Bundle> |
getBundles()
This bundle map will not change, but the status of the bundles can change over time.
|
void |
init(javax.servlet.ServletContext servletContext) |
protected void |
replaceFelixExecutionEnvironment(Properties properties)
Replace all instances of the
FELIX_EE_JAVA_SPECIFICATION_VERSION and FELIX_EE_FELIX_DETECT_JPMS
within the Constants.FRAMEWORK_EXECUTIONENVIRONMENT property of the provided properties. |
protected void |
replaceFelixFrameworkSystemCapabilities(Properties properties)
Replace all instances of the
FELIX_SERVICE_CAPS , FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION and FELIX_EE_CAP_DETECT_JPMS
within the Constants.FRAMEWORK_SYSTEMCAPABILITIES property of the provided properties. |
protected void |
replaceFelixSystemPackages(Properties properties)
Replace all instances of
FELIX_JRE_DETECT_JAVA_SPECIFICATION_VERSION and FELIX_JRE_DETECT_JPMS ,
within the Constants.FRAMEWORK_SYSTEMPACKAGES property of the provided properties. |
protected void |
startFelix() |
addAutoStartBundles, addExportedPackages, findPropertiesFileInRelativePath, getBundlesInDir, getJarUrl, getProperties, getRunLevelDirs, getServletContextParam, getVersion, getVersionFromString, replaceSystemPackages, searchForPropertiesFilesInRelativePath
protected static final String FELIX_JRE_DETECT_JAVA_SPECIFICATION_VERSION
protected static final String FELIX_JRE_DETECT_JPMS
protected static final String FELIX_DETECT_JAVA_VERSION
protected static final String FELIX_JRE_BASE_PREFIX
protected static final String FELIX_JRE_BASE_SUFFIX
protected static final String OSGI_FRAMEWORK_SYSTEM_CAPABILITIES
protected static final String OSGI_FRAMEWORK_EXECUTIONENVIRONMENT
protected static final String FELIX_SERVICE_CAPS_KEY
protected static final String FELIX_SERVICE_CAPS
protected static final String FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION
protected static final String FELIX_EE_CAP_DETECT_JPMS
protected static final String FELIX_EE_JAVA_SPECIFICATION_VERSION
protected static final String FELIX_EE_FELIX_DETECT_JPMS
protected org.apache.felix.framework.Felix felix
protected void startFelix()
public void init(javax.servlet.ServletContext servletContext)
init
in interface OsgiHost
init
in class BaseOsgiHost
public Map<String,org.osgi.framework.Bundle> getBundles()
BaseOsgiHost
getBundles
in interface OsgiHost
getBundles
in class BaseOsgiHost
public Map<String,org.osgi.framework.Bundle> getActiveBundles()
getActiveBundles
in interface OsgiHost
getActiveBundles
in class BaseOsgiHost
public org.osgi.framework.BundleContext getBundleContext()
getBundleContext
in interface OsgiHost
getBundleContext
in class BaseOsgiHost
public void destroy() throws Exception
destroy
in interface OsgiHost
destroy
in class BaseOsgiHost
Exception
protected void addSpringOSGiSupport()
addSpringOSGiSupport
in class BaseOsgiHost
protected void replaceFelixSystemPackages(Properties properties)
FELIX_JRE_DETECT_JAVA_SPECIFICATION_VERSION
and FELIX_JRE_DETECT_JPMS
,
within the Constants.FRAMEWORK_SYSTEMPACKAGES
property of the provided properties. The replacement will be the value
for the key "jre-x.y" in the properties parameter (where x.y is the JRE version after transforming the System "java.version" property.
For example: "jre-x.y" is "jre-1.8" for Java 8, "jre-9.0" for Java 9, and "jre-11.0" for Java 11.
While performing the replacement, the elements within jre-x.y will also undergo a replacement of the substring FELIX_DETECT_JAVA_VERSION
into something like "0.0.0.JavaSE_001_008" for Java 8 and earlier, "0.0.0.JavaSE_009" for Java 9 and newer. If you prefer
manual control, use literal strings rather than FELIX_DETECT_JAVA_VERSION
in your properties file.properties
- OSGi properties for which the Constants.FRAMEWORK_SYSTEMPACKAGES
property's values
substrings FELIX_JRE_DETECT_JAVA_SPECIFICATION_VERSION
and FELIX_JRE_DETECT_JPMS
will be replaced by the value for the key
"jre-xxx" (where xxx is the JRE version).
If no Constants.FRAMEWORK_SYSTEMPACKAGES
property exists, this is a no-op.protected void replaceFelixFrameworkSystemCapabilities(Properties properties)
FELIX_SERVICE_CAPS
, FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION
and FELIX_EE_CAP_DETECT_JPMS
within the Constants.FRAMEWORK_SYSTEMCAPABILITIES
property of the provided properties. The replacements will be based on the lookups within
the properties for the keys that match the substitution strings for each element (i.e. the element without "${}", transformed for JRE version if required).properties
- OSGi properties for which the Constants.FRAMEWORK_SYSTEMCAPABILITIES
property's values substrings
FELIX_SERVICE_CAPS
, FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION
and FELIX_EE_CAP_DETECT_JPMS
will be replaced by the
value for the keys that match the substitution strings for each element (i.e. the element without "${}", transformed for JRE version if required).
If no Constants.FRAMEWORK_SYSTEMCAPABILITIES
property exists, this is a no-op.protected void replaceFelixExecutionEnvironment(Properties properties)
FELIX_EE_JAVA_SPECIFICATION_VERSION
and FELIX_EE_FELIX_DETECT_JPMS
within the Constants.FRAMEWORK_EXECUTIONENVIRONMENT
property of the provided properties. The replacements will be based on the lookups within
the properties for the keys that match the substitution strings for each element (i.e. the element without "${}", transformed for JRE version if required).properties
- OSGi properties for which the Constants.FRAMEWORK_EXECUTIONENVIRONMENT
property's values substrings
FELIX_EE_JAVA_SPECIFICATION_VERSION
and FELIX_EE_FELIX_DETECT_JPMS
will be replaced by the value
for the keys that match the substitution strings for each element (i.e. the element without "${}", transformed for JRE version if required).
If no Constants.FRAMEWORK_EXECUTIONENVIRONMENT
property exists, this is a no-op.protected String expandAllFelixJREBaseElements(String jreProperty, Properties properties)
jreProperty
- A string retrieval of a JRE property entry (e.g. jre-1.7), that may or may not contain JRE base elements (e.g. ${jre-base-1.7}).properties
- The Felix properties.protected String expandAllOsgiFrameworkSystemCapabilities(String capabilities, Properties properties)
Constants.FRAMEWORK_SYSTEMCAPABILITIES
content passed into the method.capabilities
- A string retrieval of an OSGi framework system capabilities property entry Constants.FRAMEWORK_SYSTEMCAPABILITIES
containing one or more of
FELIX_SERVICE_CAPS
FELIX_EE_CAP_JAVA_SPECIFICATION_VERSION
FELIX_EE_CAP_DETECT_JPMS
.properties
- The Felix properties.Constants.FRAMEWORK_SYSTEMCAPABILITIES
content, after expanding all its contained elements in the Felix properties.protected String expandAllOsgiFrameworkExecutionEnvironments(String executionEnvironment, Properties properties)
Constants.FRAMEWORK_EXECUTIONENVIRONMENT
content passed into the method.executionEnvironment
- A string retrieval of an OSGi framework execution environment property entry Constants.FRAMEWORK_EXECUTIONENVIRONMENT
containing one or more of
FELIX_EE_JAVA_SPECIFICATION_VERSION
FELIX_EE_FELIX_DETECT_JPMS
.properties
- The Felix properties.Constants.FRAMEWORK_EXECUTIONENVIRONMENT
content, after expanding all its contained elements in the Felix properties.Copyright © 2000–2024 Apache Software Foundation. All rights reserved.