nl.gx.webmanager.services.framework.spi
Class FrameworkBase

java.lang.Object
  extended by nl.gx.webmanager.services.framework.spi.FrameworkBase
All Implemented Interfaces:
Framework, org.springframework.web.context.ServletContextAware
Direct Known Subclasses:
SpringFrameworkBase

public abstract class FrameworkBase
extends java.lang.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

Field Summary
 
Fields inherited from interface nl.gx.webmanager.services.framework.spi.Framework
CLUSTERING_NODEID_PROP, CLUSTERING_READONLY_PROP
 
Constructor Summary
FrameworkBase()
           
 
Method Summary
 java.lang.String getBaseDirectory()
          Get the applications basedirectorty.
 java.lang.String getBundleDirectory()
          Get the framework bundledirectorty.
protected  java.lang.String getBundleLocation(java.lang.String bundle)
          Returns the absolute path of a specified bundle based on the configured bundleDirectory.
 java.lang.String getCacheDirectory()
          Get the framework cachedirectorty.
 java.lang.String getClusterNodeId()
          Provides the configured cluster identifier for this node.
 java.lang.String getEditionDirectory()
          Get the framework edition bundle directory.
protected  int getInitialFrameworkStartLevel()
          Return the initialFrameworkStartLevel.
protected  java.util.Map<java.lang.Integer,java.util.List<java.lang.String>> getInstallMap()
          Return the installmap.
protected  java.util.Properties getProperties()
          Return the properties.
 java.lang.String getRepositoryDirectory()
          Get the JCR repositorydirectorty.
abstract  java.lang.Object getService(java.lang.String name)
          Provide an easy access to services based on service name.
abstract  java.lang.Object getService(java.lang.String name, java.lang.String filter)
          Provides easy access to services based on service name and optional filter.
 java.lang.String getWebrootDirectory()
          Get the webrootdirectory.
protected abstract  boolean initialize()
          Initializes the framework based on the configured system bundles.
 boolean isAvailable()
          Check whether the OSGi impl is running and available.
 boolean isClusterMasterNode()
          Indicates if this instance is a master node.
protected  boolean isForceInitialize()
          Return forceInitialize.
 boolean isStarting()
          Check whether the framework is starting up.
protected abstract  void restart()
          Restarts the framework based on the state in the configured cachedirectory.
 void setBaseDirectory(java.lang.String baseDirectory)
          Set the applications basedirectorty.
 void setBundleDirectory(java.lang.String bundleDirectory)
          Set the framework bundledirectorty.
 void setCacheDirectory(java.lang.String cacheDirectory)
          Set the applications cachedirectorty.
 void setEditionDirectory(java.lang.String editionDirectory)
          Set the framework edition bundle directory.
protected  void setForceInitialize(boolean forceInitialize)
           
 void setInitialFrameworkStartLevel(int initialFrameworkStartLevel)
           
 void setInstallMap(java.util.Map<java.lang.Integer,java.util.List<java.lang.String>> installMap)
          Public setter provided for DI.
 void setProperties(java.util.Properties properties)
          Public setter provided for DI.
 void setRepositoryDirectory(java.lang.String repositoryDirectory)
          Set the applications JCR repositorydirectorty.
 void setServletContext(javax.servlet.ServletContext servletContext)
           
 void setWebrootDirectory(java.lang.String webrootDirectory)
          Set the applications webrootdirectory.
protected abstract  void shutdown()
          Shuts down the framework.
 void start()
          Start the OSGi impl.
 void stop()
          Stop the OSGi impl.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.gx.webmanager.services.framework.spi.Framework
getServices, getServices, setFrameworkStartLevel
 

Constructor Detail

FrameworkBase

public FrameworkBase()
Method Detail

getBaseDirectory

public java.lang.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(java.lang.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 java.lang.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(java.lang.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(java.lang.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 java.lang.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 java.lang.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(java.lang.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 java.lang.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 java.lang.String getWebrootDirectory()
Description copied from interface: Framework
Get the webrootdirectory.

Specified by:
getWebrootDirectory in interface Framework
Returns:
absolute path of the webrootdirectory

setRepositoryDirectory

public void setRepositoryDirectory(java.lang.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(java.lang.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 java.util.Properties getProperties()
Return the properties.

Returns:
the properties

setProperties

public void setProperties(java.util.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 java.util.Map<java.lang.Integer,java.util.List<java.lang.String>> getInstallMap()
Return the installmap.

Returns:
the installmap

setInstallMap

public void setInstallMap(java.util.Map<java.lang.Integer,java.util.List<java.lang.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

start

public final void start()
                 throws FrameworkException
Description copied from interface: Framework
Start the OSGi impl. Must be called at init.

Specified by:
start in interface Framework
Throws:
FrameworkException - when start fails

stop

public final void stop()
                throws FrameworkException
Description copied from interface: Framework
Stop the OSGi impl. Should be called at shutdown.

Specified by:
stop in interface Framework
Throws:
FrameworkException - when shutdown fails

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 java.lang.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 java.lang.Object getService(java.lang.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 java.lang.Object getService(java.lang.String name,
                                            java.lang.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:
java.lang.Exception - if initialize fails
FrameworkException

restart

protected abstract void restart()
                         throws FrameworkException
Restarts the framework based on the state in the configured cachedirectory.

Throws:
java.lang.Exception - if retsrat fails
FrameworkException

shutdown

protected abstract void shutdown()
                          throws FrameworkException
Shuts down the framework.

Throws:
java.lang.Exception - it shutdown fails
FrameworkException

getBundleLocation

protected java.lang.String getBundleLocation(java.lang.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


Copyright © 2007-2011 GX Software BV. All Rights Reserved.