public abstract class BaseOsgiHost extends Object implements OsgiHost
struts.osgi.searchForPropertiesFilesInRelativePath: Defaults to "false". Set to "true" for fallback search for properties files in relative path (e.g. for unit testing).
| Modifier and Type | Field and Description | 
|---|---|
| protected static String | DETECT_JAVA_VERSION | 
| protected static String | JRE_JAVA_SPECIFICATION_VERSION | 
| protected static String | SCANNING_PACKAGE_INCLUDES | 
| protected javax.servlet.ServletContext | servletContext | 
| protected static Pattern | VERSION_PATTERN | 
| protected static Pattern | versionPatternDeprecated. 
 use  VERSION_PATTERNinstead | 
OSGI_BUNDLE_CONTEXT, OSGI_HEADER_STRUTS_ENABLED| Constructor and Description | 
|---|
| BaseOsgiHost() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | addAutoStartBundles(Properties configProps) | 
| protected void | addExportedPackages(Properties strutsConfigProps,
                   Properties configProps)Find sub-packages of the packages defined in the property file and export them | 
| protected abstract void | addSpringOSGiSupport() | 
| abstract void | destroy() | 
| protected Properties | findPropertiesFileInRelativePath(String fileName)Attempt to read a properties file from the relative path of the current classloader. | 
| abstract Map<String,org.osgi.framework.Bundle> | getActiveBundles() | 
| abstract org.osgi.framework.BundleContext | getBundleContext() | 
| abstract Map<String,org.osgi.framework.Bundle> | getBundles()This bundle map will not change, but the status of the bundles can change over time. | 
| protected List<String> | getBundlesInDir(String dir) | 
| protected String | getJarUrl(Class clazz) | 
| protected Properties | getProperties(String fileName) | 
| protected Map<String,String> | getRunLevelDirs(String dir) | 
| protected String | getServletContextParam(String paramName,
                      String defaultValue)Gets a param from the ServletContext, returning the default value if the param is not set | 
| protected String | getVersion(URL url) | 
| protected String | getVersionFromString(String str) | 
| abstract void | init(javax.servlet.ServletContext servletContext) | 
| protected void | replaceSystemPackages(Properties properties)Replace all instances of  JRE_JAVA_SPECIFICATION_VERSION, within theConstants.FRAMEWORK_SYSTEMPACKAGESproperty of the provided properties. | 
| protected boolean | searchForPropertiesFilesInRelativePath()Check ServletContext initialization parameter "struts.osgi.searchForPropertiesFilesInRelativePath". | 
protected static final Pattern VERSION_PATTERN
protected static final String SCANNING_PACKAGE_INCLUDES
protected static final String JRE_JAVA_SPECIFICATION_VERSION
protected static final String DETECT_JAVA_VERSION
@Deprecated protected static final Pattern versionPattern
VERSION_PATTERN insteadprotected javax.servlet.ServletContext servletContext
public abstract void init(javax.servlet.ServletContext servletContext)
public abstract void destroy()
                      throws Exception
public abstract Map<String,org.osgi.framework.Bundle> getBundles()
getBundles in interface OsgiHostpublic abstract Map<String,org.osgi.framework.Bundle> getActiveBundles()
getActiveBundles in interface OsgiHostpublic abstract org.osgi.framework.BundleContext getBundleContext()
getBundleContext in interface OsgiHostprotected abstract void addSpringOSGiSupport()
protected String getServletContextParam(String paramName, String defaultValue)
paramName - the name of the param to get from the ServletContextdefaultValue - value to return if the param is not setprotected void addAutoStartBundles(Properties configProps)
protected Map<String,String> getRunLevelDirs(String dir)
dir - directoryprotected void replaceSystemPackages(Properties properties)
JRE_JAVA_SPECIFICATION_VERSION, 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 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 DETECT_JAVA_VERSION in your properties file.properties - OSGi properties for which the Constants.FRAMEWORK_SYSTEMPACKAGES property's values
                   substrings JRE_JAVA_SPECIFICATION_VERSION 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 addExportedPackages(Properties strutsConfigProps, Properties configProps)
strutsConfigProps - Struts-OSGi configuration properties containing the SCANNING_PACKAGE_INCLUDES property
                          containing comma-separated top-level package values.configProps - OSGi configuration properties for which the Constants.FRAMEWORK_SYSTEMPACKAGES property's
                    value will have the sub-packages of strutsConfigProps appended to it.
                    If no Constants.FRAMEWORK_SYSTEMPACKAGES property exists, and the exported packages is non-empty,
                    then one is created that will contain the sub-packages of strutsConfigProps.protected String getVersion(URL url)
url - URL for packageprotected String getVersionFromString(String str)
str - string for extract versionprotected Properties getProperties(String fileName)
protected boolean searchForPropertiesFilesInRelativePath()
protected Properties findPropertiesFileInRelativePath(String fileName) throws IOException
fileName - the filename (relative path) of the properties file.IOException - if the properties file does not exist or cannot be loaded.Copyright © 2000–2025 Apache Software Foundation. All rights reserved.