Class FrameworkBase

  • All Implemented Interfaces:
    Framework, org.springframework.beans.factory.Aware, org.springframework.web.context.ServletContextAware
    Direct Known Subclasses:
    SpringFrameworkBase

    public abstract class FrameworkBase
    extends Object
    implements Framework, org.springframework.web.context.ServletContextAware
    Abstract implementation of the FrameWork interface. Provides (default) implementations of the methods required by setter based dependency injection.
    Author:
    bramk
    • Constructor Detail

      • FrameworkBase

        public FrameworkBase()
    • Method Detail

      • getBaseDirectory

        public String getBaseDirectory()
        Description copied from interface: Framework
        Get the applications basedirectorty.
        Specified by:
        getBaseDirectory in interface Framework
        Returns:
        absolute path of the basedirectory
      • setBaseDirectory

        public void setBaseDirectory​(String baseDirectory)
                              throws ConfigurationException
        Description copied from interface: Framework
        Set the applications basedirectorty. Public setter provided for DI.
        Specified by:
        setBaseDirectory in interface Framework
        Parameters:
        baseDirectory - absolute path to the basedirectory on the filesystem.
        Throws:
        ConfigurationException - when the directory is not accessible
      • getBundleDirectory

        public String getBundleDirectory()
        Description copied from interface: Framework
        Get the framework bundledirectorty.
        Specified by:
        getBundleDirectory in interface Framework
        Returns:
        absolute path of the bundledirectory
      • setBundleDirectory

        public final void setBundleDirectory​(String bundleDirectory)
                                      throws ConfigurationException
        Description copied from interface: Framework
        Set the framework bundledirectorty. Public setter provided for DI.
        Specified by:
        setBundleDirectory in interface Framework
        Parameters:
        bundleDirectory - absolute path to the bundledirectory on the filesystem.
        Throws:
        ConfigurationException - when the directory is not accessible
      • setEditionDirectory

        public final void setEditionDirectory​(String editionDirectory)
        Description copied from interface: Framework
        Set the framework edition bundle directory. Public setter provided for DI.
        Specified by:
        setEditionDirectory in interface Framework
        Parameters:
        editionDirectory - the directory injected by Spring
      • getEditionDirectory

        public final String getEditionDirectory()
        Description copied from interface: Framework
        Get the framework edition bundle directory.
        Specified by:
        getEditionDirectory in interface Framework
        Returns:
        the configured edition directory, or null if configuration failed
      • getCacheDirectory

        public String getCacheDirectory()
        Description copied from interface: Framework
        Get the framework cachedirectorty.
        Specified by:
        getCacheDirectory in interface Framework
        Returns:
        absolute path of the cachedirectorty
      • setCacheDirectory

        public final void setCacheDirectory​(String cacheDirectory)
                                     throws ConfigurationException
        Description copied from interface: Framework
        Set the applications cachedirectorty. Public setter provided for DI.
        Specified by:
        setCacheDirectory in interface Framework
        Parameters:
        cacheDirectory - absolute path to the cachedirectory on the filesystem.
        Throws:
        ConfigurationException - when the directory is not accessible
      • getRepositoryDirectory

        public String getRepositoryDirectory()
        Description copied from interface: Framework
        Get the JCR repositorydirectorty.
        Specified by:
        getRepositoryDirectory in interface Framework
        Returns:
        absolute path of the repositorydirectorty
      • getWebrootDirectory

        public String getWebrootDirectory()
        Description copied from interface: Framework
        Get the webrootdirectory.
        Specified by:
        getWebrootDirectory in interface Framework
        Returns:
        absolute path of the webrootdirectory
      • getWorkDirectory

        public String getWorkDirectory()
        Description copied from interface: Framework
        Get the applications workdirectory
        Specified by:
        getWorkDirectory in interface Framework
        Returns:
        absolute path of the workdirectory
      • setWorkDirectory

        public final void setWorkDirectory​(String workDirectory)
        Parameters:
        workDirectory - the directory injected by Spring
      • setRepositoryDirectory

        public void setRepositoryDirectory​(String repositoryDirectory)
                                    throws ConfigurationException
        Description copied from interface: Framework
        Set the applications JCR repositorydirectorty. Public setter provided for DI.
        Specified by:
        setRepositoryDirectory in interface Framework
        Parameters:
        repositoryDirectory - absolute path to the repositorydirectorty on the filesystem.
        Throws:
        ConfigurationException - when the directory is not accessible
      • setWebrootDirectory

        public void setWebrootDirectory​(String webrootDirectory)
                                 throws ConfigurationException
        Description copied from interface: Framework
        Set the applications webrootdirectory. Public setter provided for DI.
        Specified by:
        setWebrootDirectory in interface Framework
        Parameters:
        webrootDirectory - absolute path to the webrootdirectory on the filesystem.
        Throws:
        ConfigurationException - when the directory is not accessible
      • isForceInitialize

        protected boolean isForceInitialize()
        Return forceInitialize.
        Returns:
        forceInitialize
      • setForceInitialize

        protected void setForceInitialize​(boolean forceInitialize)
        Parameters:
        forceInitialize -
      • getProperties

        protected Properties getProperties()
        Return the properties.
        Returns:
        the properties
      • setProperties

        public void setProperties​(Properties properties)
        Description copied from interface: Framework
        Public setter provided for DI.
        Specified by:
        setProperties in interface Framework
        Parameters:
        properties - startupproperties provided for the concrete framework implementation.
      • getInstallMap

        protected Map<Integer,​List<String>> getInstallMap()
        Return the installmap.
        Returns:
        the installmap
      • setInstallMap

        public void setInstallMap​(Map<Integer,​List<String>> installMap)
        Description copied from interface: Framework
        Public setter provided for DI.
        Specified by:
        setInstallMap in interface Framework
        Parameters:
        installMap - map containing bundlenames to be installed for any startlevel.
      • getInitialFrameworkStartLevel

        protected int getInitialFrameworkStartLevel()
        Return the initialFrameworkStartLevel.
        Returns:
        the initialFrameworkStartLevel
      • setInitialFrameworkStartLevel

        public void setInitialFrameworkStartLevel​(int initialFrameworkStartLevel)
      • setServletContext

        public void setServletContext​(javax.servlet.ServletContext servletContext)
        Specified by:
        setServletContext in interface org.springframework.web.context.ServletContextAware
      • isStarting

        public boolean isStarting()
        Description copied from interface: Framework
        Check whether the framework is starting up.
        Specified by:
        isStarting in interface Framework
        Returns:
        True if the OSGi impl is busy starting up.
      • isAvailable

        public boolean isAvailable()
        Description copied from interface: Framework
        Check whether the OSGi impl is running and available.
        Specified by:
        isAvailable in interface Framework
        Returns:
        True if the OSGi impl is up and running. If isStarting() is false and this returns false, then the framework is unavailable (error).
      • isClusterMasterNode

        public boolean isClusterMasterNode()
        Description copied from interface: Framework
        Indicates if this instance is a master node.
        Specified by:
        isClusterMasterNode in interface Framework
        Returns:
        true if this is a master node, else false.
      • getClusterNodeId

        public String getClusterNodeId()
        Description copied from interface: Framework
        Provides the configured cluster identifier for this node.
        Specified by:
        getClusterNodeId in interface Framework
        Returns:
        the string identifier for this node.
      • getService

        public abstract Object getService​(String name)
                                   throws FrameworkException
        Description copied from interface: Framework
        Provide an easy access to services based on service name.
        Specified by:
        getService in interface Framework
        Parameters:
        name - fully qualified name of the requested service interface.
        Returns:
        an instance of the service (if available)
        Throws:
        FrameworkException
      • getService

        public abstract Object getService​(String name,
                                          String filter)
                                   throws FrameworkException
        Description copied from interface: Framework
        Provides easy access to services based on service name and optional filter.
        Specified by:
        getService in interface Framework
        Parameters:
        name - fully qualified name of the requested service interface
        filter - LDAP filter for serviceregistration
        Returns:
        an instance of the service (if available)
        Throws:
        FrameworkException
      • initialize

        protected abstract boolean initialize()
                                       throws FrameworkException
        Initializes the framework based on the configured system bundles. This method is called when no cache directory is present either because this is the first time the service framework is started or because initialize is forced.
        Throws:
        Exception - if initialize fails
        FrameworkException
      • getBundleLocation

        protected String getBundleLocation​(String bundle)
        Returns the absolute path of a specified bundle based on the configured bundleDirectory. Returns null if the bundle doesn't exists on disk.
        Parameters:
        bundle - name of the bundle
        Returns:
        absolute path to the bundle or null