com.ibm.tivoli.maximo.report.birt.bridge.launcher

Class FrameworkLauncher

  • java.lang.Object
    • com.ibm.tivoli.maximo.report.birt.bridge.launcher.FrameworkLauncher
  • Direct Known Subclasses:
    MXWebAppOSGiFrameworkLauncher


    public class FrameworkLauncher
    extends java.lang.Object
    The FrameworkLauncher provides the logic to: 1) init 2) deploy 3) start 4) stop 5) undeploy 6) destroy an instance of the OSGi framework. These 6 methods are provided to help manage the lifecycle and are called from outside this class by the BridgeServlet. To create an extended FrameworkLauncher over-ride these methods to allow custom behaviour.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      protected class  FrameworkLauncher.ChildFirstURLClassLoader
      The ChildFirstURLClassLoader alters regular ClassLoader delegation and will check the URLs used in its initialization for matching classes before delegating to it's parent.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      protected java.lang.String[] buildCommandLineArguments()
      buildCommandLineArguments parses the commandline config parameter into a set of arguments
      protected java.util.Map buildInitialPropertyMap()
      buildInitialPropertyMap create the inital set of properties from the contents of launch.ini and for a few other properties necessary to launch defaults are supplied if not provided.
      protected void copyResource(java.lang.String resourcePath, java.io.File target)
      copyResource is a convenience method to recursively copy resources from the ServletContext to an installation target.
      protected static boolean deleteDirectory(java.io.File directory)
      deleteDirectory is a cocnvenience method to recursively delete a directory
      void deploy()
      Deploy the OSGi framework libraries into a location suitable for execution.
      void destroy() 
      protected int findMax(java.lang.String[] candidates) 
      java.lang.ClassLoader getFrameworkContextClassLoader()
      Used when to set the ContextClassLoader when the BridgeServlet delegates to a Servlet inside the framework
      java.util.Properties getFrameworkInternalProperties(java.lang.ClassLoader cl) 
      protected java.io.File getPlatformDirectory()
      Platfom Directory is where the OSGi software is installed
      void init() 
      void init(javax.servlet.ServletConfig servletConfig) 
      protected java.util.Properties loadProperties(java.lang.String resource)
      loadProperties is a convenience method to load properties from a servlet context resource
      protected java.lang.String searchFor(java.lang.String target, java.lang.String start)
      Searches for the given target directory starting in the "plugins" subdirectory of the given location.
      void start()
      Start OSGi framework Read launcher.ini to create a set of initial properties and use the "commandline" configuration parameter to create the equivalent command line arguments available when starting Eclipse.
      void stop()
      stop is used to "shutdown" the framework and make it avialable for garbage collection.
      void undeploy()
      Undeploy the OSGi framework libraries from the execution location.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FRAMEWORK_BUNDLE_NAME

        protected static final java.lang.String FRAMEWORK_BUNDLE_NAME
        See Also:
        Constant Field Values
      • NULL_IDENTIFIER

        protected static final java.lang.String NULL_IDENTIFIER
        See Also:
        Constant Field Values
      • OSGI_INSTANCE_AREA

        protected static final java.lang.String OSGI_INSTANCE_AREA
        See Also:
        Constant Field Values
      • OSGI_CONFIGURATION_AREA

        protected static final java.lang.String OSGI_CONFIGURATION_AREA
        See Also:
        Constant Field Values
      • OSGI_INSTALL_AREA

        protected static final java.lang.String OSGI_INSTALL_AREA
        See Also:
        Constant Field Values
      • config

        protected javax.servlet.ServletConfig config
      • context

        protected javax.servlet.ServletContext context
    • Constructor Detail

      • FrameworkLauncher

        public FrameworkLauncher()
    • Method Detail

      • init

        public void init(javax.servlet.ServletConfig servletConfig)
      • init

        public void init()
      • destroy

        public void destroy()
      • deploy

        public void deploy()
        Deploy the OSGi framework libraries into a location suitable for execution.
      • undeploy

        public void undeploy()
        Undeploy the OSGi framework libraries from the execution location.
      • start

        public void start()
        Start OSGi framework Read launcher.ini to create a set of initial properties and use the "commandline" configuration parameter to create the equivalent command line arguments available when starting Eclipse.
      • getFrameworkInternalProperties

        public java.util.Properties getFrameworkInternalProperties(java.lang.ClassLoader cl)
      • buildInitialPropertyMap

        protected java.util.Map buildInitialPropertyMap()
        buildInitialPropertyMap create the inital set of properties from the contents of launch.ini and for a few other properties necessary to launch defaults are supplied if not provided. The value '@null' will set the map value to null.
        Returns:
        a map containing the initial properties
      • buildCommandLineArguments

        protected java.lang.String[] buildCommandLineArguments()
        buildCommandLineArguments parses the commandline config parameter into a set of arguments
        Returns:
        an array of String containing the commandline arguments
      • stop

        public void stop()
        stop is used to "shutdown" the framework and make it avialable for garbage collection. The default implementation also has special handling for Apache Commons Logging to "release" any resources associated with the frameworkContextClassLoader.
      • copyResource

        protected void copyResource(java.lang.String resourcePath,
                                    java.io.File target)
        copyResource is a convenience method to recursively copy resources from the ServletContext to an installation target. The default behaviour will create a directory if the resourcepath ends in '/' and a file otherwise.
        Parameters:
        resourcePath - - The resource root path
        target - - The root location where resources are to be copied
      • deleteDirectory

        protected static boolean deleteDirectory(java.io.File directory)
        deleteDirectory is a cocnvenience method to recursively delete a directory
        Parameters:
        directory - - the directory to delete.
        Returns:
        was the delete succesful
      • getFrameworkContextClassLoader

        public java.lang.ClassLoader getFrameworkContextClassLoader()
        Used when to set the ContextClassLoader when the BridgeServlet delegates to a Servlet inside the framework
        Returns:
        a Classloader with the OSGi framework's context classloader.
      • getPlatformDirectory

        protected java.io.File getPlatformDirectory()
        Platfom Directory is where the OSGi software is installed
        Returns:
        the framework install location
      • loadProperties

        protected java.util.Properties loadProperties(java.lang.String resource)
        loadProperties is a convenience method to load properties from a servlet context resource
        Parameters:
        resource - - The target to read properties from
        Returns:
        the properties
      • searchFor

        protected java.lang.String searchFor(java.lang.String target,
                                             java.lang.String start)
        Searches for the given target directory starting in the "plugins" subdirectory of the given location. If one is found then this location is returned; otherwise an exception is thrown.
        Parameters:
        target -
        start - the location to begin searching
        Returns:
        the location where target directory was found
      • findMax

        protected int findMax(java.lang.String[] candidates)