org.apache.struts2.osgi.host
Class BaseOsgiHost

java.lang.Object
  extended by org.apache.struts2.osgi.host.BaseOsgiHost
All Implemented Interfaces:
OsgiHost
Direct Known Subclasses:
FelixOsgiHost, GlassfishOSGiHost

public abstract class BaseOsgiHost
extends Object
implements OsgiHost

A base OsgiHost implementation


Field Summary
protected  javax.servlet.ServletContext servletContext
           
protected static Pattern versionPattern
           
 
Fields inherited from interface org.apache.struts2.osgi.host.OsgiHost
OSGI_BUNDLE_CONTEXT, OSGI_HEADER_STRUTS_ENABLED
 
Constructor Summary
BaseOsgiHost()
           
 
Method Summary
protected  void addAutoStartBundles(Properties configProps)
           
protected  void addExportedPackages(Properties strutsConfigProps, Properties configProps)
           
protected abstract  void addSpringOSGiSupport()
           
abstract  void destroy()
           
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)
          Return a list of directories under a directory whose name is a number
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)
          Gets the version used to export the packages.
protected  String getVersionFromString(String str)
          Extracts numbers followed by "." or "-" from the string and joins them with "."
abstract  void init(javax.servlet.ServletContext servletContext)
           
protected  void replaceSystemPackages(Properties properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionPattern

protected static final Pattern versionPattern

servletContext

protected javax.servlet.ServletContext servletContext
Constructor Detail

BaseOsgiHost

public BaseOsgiHost()
Method Detail

init

public abstract void init(javax.servlet.ServletContext servletContext)
Specified by:
init in interface OsgiHost

destroy

public abstract void destroy()
                      throws Exception
Specified by:
destroy in interface OsgiHost
Throws:
Exception

getBundles

public abstract Map<String,org.osgi.framework.Bundle> getBundles()
This bundle map will not change, but the status of the bundles can change over time. Use getActiveBundles() for active bundles

Specified by:
getBundles in interface OsgiHost

getActiveBundles

public abstract Map<String,org.osgi.framework.Bundle> getActiveBundles()
Specified by:
getActiveBundles in interface OsgiHost

getBundleContext

public abstract org.osgi.framework.BundleContext getBundleContext()
Specified by:
getBundleContext in interface OsgiHost

addSpringOSGiSupport

protected abstract void addSpringOSGiSupport()

getServletContextParam

protected String getServletContextParam(String paramName,
                                        String defaultValue)
Gets a param from the ServletContext, returning the default value if the param is not set

Parameters:
paramName - the name of the param to get from the ServletContext
defaultValue - value to return if the param is not set
Returns:

addAutoStartBundles

protected void addAutoStartBundles(Properties configProps)

getRunLevelDirs

protected Map<String,String> getRunLevelDirs(String dir)
Return a list of directories under a directory whose name is a number


getBundlesInDir

protected List<String> getBundlesInDir(String dir)

getJarUrl

protected String getJarUrl(Class clazz)

replaceSystemPackages

protected void replaceSystemPackages(Properties properties)

addExportedPackages

protected void addExportedPackages(Properties strutsConfigProps,
                                   Properties configProps)

getVersion

protected String getVersion(URL url)
Gets the version used to export the packages. it tries to get it from MANIFEST.MF, or the file name


getVersionFromString

protected String getVersionFromString(String str)
Extracts numbers followed by "." or "-" from the string and joins them with "."


getProperties

protected Properties getProperties(String fileName)


Copyright © 2000–2017 Apache Software Foundation. All rights reserved.