com.dtolabs.rundeck.core.common
Class Framework

java.lang.Object
  extended by com.dtolabs.rundeck.core.common.FrameworkResource
      extended by com.dtolabs.rundeck.core.common.FrameworkResourceParent
          extended by com.dtolabs.rundeck.core.common.Framework
All Implemented Interfaces:
IFrameworkResource, IFrameworkResourceParent

public class Framework
extends FrameworkResourceParent

Manages the elements of the Ctl framework. Provides access to the various kinds of framework resource managers like FrameworkProjectMgr, ModuleMgr, Authenticator, Authorization.

User: alexh Date: Jun 4, 2004 Time: 8:16:42 PM


Nested Class Summary
 
Nested classes/interfaces inherited from class com.dtolabs.rundeck.core.common.FrameworkResourceParent
FrameworkResourceParent.NoSuchResourceException
 
Field Summary
static java.lang.String CENTRALDISPATCHER_CLS_PROP
           
static java.lang.String DEFAULT_LIBEXT_CACHE_DIR_NAME
           
static java.lang.String DEFAULT_LIBEXT_DIR_NAME
           
static java.lang.String FRAMEWORK_LIBEXT_CACHE_DIR
           
static java.lang.String FRAMEWORK_LIBEXT_DIR
           
static java.lang.String FRAMEWORK_PLUGINS_ENABLED
           
static org.apache.log4j.Logger logger
           
static java.lang.String NODES_FILE_AUTOGEN_PROP
           
static java.lang.String NODES_RESOURCES_FILE_PROP
           
static java.lang.String SYSTEM_PROP_LIBEXT
           
static java.lang.String SYSTEM_PROP_LIBEXT_CACHE
           
 
Fields inherited from class com.dtolabs.rundeck.core.common.FrameworkResource
VALID_RESOURCE_NAME_REGEX
 
Method Summary
 boolean childCouldBeLoaded(java.lang.String name)
          Default implementation checks whether a subdir under the basedir exists with the specified name.
 NodeEntryImpl createFrameworkNode()
          Generate a node entry for the framework with default values
 INodeSet filterAuthorizedNodes(java.lang.String project, java.util.Set<java.lang.String> actions, INodeSet unfiltered)
          Return the nodeset consisting only of the input nodes where the specified actions are all authorized
 java.util.Collection<INodeEntry> filterNodes(NodesSelector nodeset, java.lang.String project, java.io.File nodesFile)
          Read the nodes file for a project and return a filtered set of nodes
 INodeSet filterNodeSet(NodesSelector nodeset, java.lang.String project, java.io.File nodesFile)
          Read the nodes file for a project and return a filtered set of nodes
 Authenticator getAuthenticationMgr()
          Gets Authenticator for this framework instance
 LegacyAuthorization getAuthorizationMgr()
           
 CentralDispatcher getCentralDispatcherMgr()
          Return CentralDispatcher implementation.
 java.io.File getConfigDir()
           
 ExecutionService getExecutionService()
           
 FileCopier getFileCopierForNodeAndProject(INodeEntry node, java.lang.String project)
           
 FileCopierService getFileCopierService()
           
 java.lang.String getFrameworkNodeHostname()
          Gets the value of "framework.node.hostname" property
 java.lang.String getFrameworkNodeName()
          Gets the value of "framework.node.name" property
 IFrameworkProjectMgr getFrameworkProjectMgr()
          Gets DepotMgr for this framework instance
 java.io.File getFrameworkProjectsBaseDir()
           
 java.io.File getHomeDir()
           
static Framework getInstance()
          Factory method to getting the singleton instance of the Framework object.
static Framework getInstance(java.lang.String rdeck_base_dir)
          Returns an instance of Framework object.
static Framework getInstance(java.lang.String rdeck_base_dir, Authenticator authenticator, LegacyAuthorization authorization)
          Returns an instance of Framework object.
static Framework getInstance(java.lang.String rdeck_base_dir, java.lang.String projects_base_dir)
          Returns the singleton instance of Framework object.
 java.io.File getLibextCacheDir()
          Return the cache directory used by the plugin system
 java.io.File getLibextDir()
          Return the directory containing plugins/extensions for the framework.
 INodeDesc getNodeDesc()
          Gets the INodeDesc value describing the framework node
 NodeDispatcher getNodeDispatcherForContext(ExecutionContext context)
           
 NodeExecutor getNodeExecutorForNodeAndProject(INodeEntry node, java.lang.String project)
           
 NodeExecutorService getNodeExecutorService()
           
 NodeStepExecutor getNodeStepExecutorForItem(NodeStepExecutionItem item)
           
 NodeStepExecutionService getNodeStepExecutorService()
           
 IFrameworkResourceParent getParent()
          This is the root.
 ServiceProviderLoader getPluginManager()
           
 java.lang.String getProjectProperty(java.lang.String project, java.lang.String key)
          Return the property value for the key from the project or framework properties if it exists, otherwise return null.
 java.lang.String getProperty(java.lang.String name)
          Return the property value by name
 IPropertyLookup getPropertyLookup()
           
 PropertyRetriever getPropertyRetriever()
          Return a PropertyRetriever interface for framework-scoped properties
 ResourceFormatGeneratorService getResourceFormatGeneratorService()
           
 ResourceFormatParserService getResourceFormatParserService()
           
 ResourceModelSourceService getResourceModelSourceService()
           
 FrameworkSupportService getService(java.lang.String name)
          Return a service by name
 StepExecutionService getStepExecutionService()
           
 WorkflowExecutionService getWorkflowExecutionService()
           
 boolean hasProjectProperty(java.lang.String key, java.lang.String project)
          Return true if the property is set for the project or the framework
 boolean hasProperty(java.lang.String key)
          Return true if the property exists
 void initialize()
          Initialize children, the various resource management objects
 boolean isLocalNode(INodeDesc node)
          Return true if the node is the local framework node.
 java.util.Collection listChildNames()
          Default implementation lists the subdirectory names and adds any existing child names
 IFrameworkResource loadChild(java.lang.String name)
          Load a specified child by name, returning null if it does not exist
 void setAuthenticationMgr(Authenticator authenticationMgr)
           
 void setAuthorizationMgr(LegacyAuthorization authorizationMgr)
           
 void setCentralDispatcherMgr(CentralDispatcher centralDispatcherMgr)
          Set the CentralDispatcherMgr instance
 void setService(java.lang.String name, FrameworkSupportService service)
          Set a service by name
 java.lang.String toString()
          Returns a string with useful information for debugging.
 
Methods inherited from class com.dtolabs.rundeck.core.common.FrameworkResourceParent
createChild, existsChild, existsChildResourceDirectory, getChild, getChildren, listChildren, remove
 
Methods inherited from class com.dtolabs.rundeck.core.common.FrameworkResource
getBaseDir, getLogger, getName, isValid, storeProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.dtolabs.rundeck.core.common.IFrameworkResource
getBaseDir, getName, isValid
 

Field Detail

logger

public static final org.apache.log4j.Logger logger

CENTRALDISPATCHER_CLS_PROP

public static final java.lang.String CENTRALDISPATCHER_CLS_PROP
See Also:
Constant Field Values

NODES_RESOURCES_FILE_PROP

public static final java.lang.String NODES_RESOURCES_FILE_PROP
See Also:
Constant Field Values

NODES_FILE_AUTOGEN_PROP

public static final java.lang.String NODES_FILE_AUTOGEN_PROP
See Also:
Constant Field Values

FRAMEWORK_LIBEXT_DIR

public static final java.lang.String FRAMEWORK_LIBEXT_DIR
See Also:
Constant Field Values

FRAMEWORK_LIBEXT_CACHE_DIR

public static final java.lang.String FRAMEWORK_LIBEXT_CACHE_DIR
See Also:
Constant Field Values

DEFAULT_LIBEXT_DIR_NAME

public static final java.lang.String DEFAULT_LIBEXT_DIR_NAME
See Also:
Constant Field Values

DEFAULT_LIBEXT_CACHE_DIR_NAME

public static final java.lang.String DEFAULT_LIBEXT_CACHE_DIR_NAME
See Also:
Constant Field Values

SYSTEM_PROP_LIBEXT

public static final java.lang.String SYSTEM_PROP_LIBEXT
See Also:
Constant Field Values

SYSTEM_PROP_LIBEXT_CACHE

public static final java.lang.String SYSTEM_PROP_LIBEXT_CACHE
See Also:
Constant Field Values

FRAMEWORK_PLUGINS_ENABLED

public static final java.lang.String FRAMEWORK_PLUGINS_ENABLED
See Also:
Constant Field Values
Method Detail

getParent

public IFrameworkResourceParent getParent()
This is the root. Does not return a parent.

Specified by:
getParent in interface IFrameworkResource
Overrides:
getParent in class FrameworkResource
Throws:
FrameworkResourceException - Throws an exception if this is called

childCouldBeLoaded

public boolean childCouldBeLoaded(java.lang.String name)
Description copied from class: FrameworkResourceParent
Default implementation checks whether a subdir under the basedir exists with the specified name. (Calls FrameworkResourceParent.existsChildResourceDirectory(String)) Should be overridden by subtypes if this is not the desired behavior.

Specified by:
childCouldBeLoaded in interface IFrameworkResourceParent
Overrides:
childCouldBeLoaded in class FrameworkResourceParent
Returns:

loadChild

public IFrameworkResource loadChild(java.lang.String name)
Description copied from interface: IFrameworkResourceParent
Load a specified child by name, returning null if it does not exist

Returns:

listChildNames

public java.util.Collection listChildNames()
Description copied from class: FrameworkResourceParent
Default implementation lists the subdirectory names and adds any existing child names

Specified by:
listChildNames in interface IFrameworkResourceParent
Overrides:
listChildNames in class FrameworkResourceParent
Returns:
A Collection of Strings

initialize

public void initialize()
Initialize children, the various resource management objects

Specified by:
initialize in interface IFrameworkResourceParent
Overrides:
initialize in class FrameworkResourceParent

getCentralDispatcherMgr

public CentralDispatcher getCentralDispatcherMgr()
Return CentralDispatcher implementation.

Returns:
in implementation

getAuthorizationMgr

public LegacyAuthorization getAuthorizationMgr()

getAuthenticationMgr

public Authenticator getAuthenticationMgr()
Gets Authenticator for this framework instance

Returns:
returns instance of Authenticator

getFrameworkProjectMgr

public IFrameworkProjectMgr getFrameworkProjectMgr()
Gets DepotMgr for this framework instance

Returns:
returns instance of IFrameworkProjectMgr

getService

public FrameworkSupportService getService(java.lang.String name)
Return a service by name


setService

public void setService(java.lang.String name,
                       FrameworkSupportService service)
Set a service by name


getExecutionService

public ExecutionService getExecutionService()

getWorkflowExecutionService

public WorkflowExecutionService getWorkflowExecutionService()

getStepExecutionService

public StepExecutionService getStepExecutionService()

getFileCopierForNodeAndProject

public FileCopier getFileCopierForNodeAndProject(INodeEntry node,
                                                 java.lang.String project)
                                          throws ExecutionServiceException
Throws:
ExecutionServiceException

getFileCopierService

public FileCopierService getFileCopierService()

getNodeExecutorForNodeAndProject

public NodeExecutor getNodeExecutorForNodeAndProject(INodeEntry node,
                                                     java.lang.String project)
                                              throws ExecutionServiceException
Throws:
ExecutionServiceException

getNodeExecutorService

public NodeExecutorService getNodeExecutorService()
                                           throws ExecutionServiceException
Throws:
ExecutionServiceException

getNodeStepExecutorService

public NodeStepExecutionService getNodeStepExecutorService()
                                                    throws ExecutionServiceException
Throws:
ExecutionServiceException

getNodeStepExecutorForItem

public NodeStepExecutor getNodeStepExecutorForItem(NodeStepExecutionItem item)
                                            throws ExecutionServiceException
Throws:
ExecutionServiceException

getNodeDispatcherForContext

public NodeDispatcher getNodeDispatcherForContext(ExecutionContext context)
                                           throws ExecutionServiceException
Throws:
ExecutionServiceException

getResourceModelSourceService

public ResourceModelSourceService getResourceModelSourceService()

getResourceFormatParserService

public ResourceFormatParserService getResourceFormatParserService()

getResourceFormatGeneratorService

public ResourceFormatGeneratorService getResourceFormatGeneratorService()

getPluginManager

public ServiceProviderLoader getPluginManager()

getInstance

public static Framework getInstance(java.lang.String rdeck_base_dir,
                                    java.lang.String projects_base_dir)
Returns the singleton instance of Framework object. If any of the supplied directory paths are null, then the value from Constants is used.

Parameters:
rdeck_base_dir - path name to the rdeck_base
module_base_dir - path name to the modle base
projects_base_dir - path name to the projects base
Returns:
a Framework instance

getInstance

public static Framework getInstance(java.lang.String rdeck_base_dir)
Returns an instance of Framework object. Specify the rdeck_base path and let the projects and modules dir be constructed from it.

Parameters:
rdeck_base_dir - path name to the rdeck_base
Returns:
a Framework instance

getInstance

public static Framework getInstance(java.lang.String rdeck_base_dir,
                                    Authenticator authenticator,
                                    LegacyAuthorization authorization)
Returns an instance of Framework object. Specify the rdeck_base path and let the projects and modules dir be constructed from it.

Parameters:
rdeck_base_dir - path name to the rdeck_base
Returns:
a Framework instance

getInstance

public static Framework getInstance()
Factory method to getting the singleton instance of the Framework object. Info about the rdeck.base, projects.base and modules.base are retrieved via Constants.

Returns:
returns Framework singleton instance. Creates it using info from Constants data. Assumes rdeck.home and rdeck.base System props are set

setCentralDispatcherMgr

public void setCentralDispatcherMgr(CentralDispatcher centralDispatcherMgr)
Set the CentralDispatcherMgr instance

Parameters:
centralDispatcherMgr - the instance

getProperty

public java.lang.String getProperty(java.lang.String name)
Return the property value by name

Parameters:
name - Property key
Returns:
property value

getPropertyRetriever

public PropertyRetriever getPropertyRetriever()
Return a PropertyRetriever interface for framework-scoped properties


hasProperty

public boolean hasProperty(java.lang.String key)
Return true if the property exists


hasProjectProperty

public boolean hasProjectProperty(java.lang.String key,
                                  java.lang.String project)
Return true if the property is set for the project or the framework


getProjectProperty

public java.lang.String getProjectProperty(java.lang.String project,
                                           java.lang.String key)
Return the property value for the key from the project or framework properties if it exists, otherwise return null.


getPropertyLookup

public IPropertyLookup getPropertyLookup()

toString

public java.lang.String toString()
Returns a string with useful information for debugging.

Overrides:
toString in class FrameworkResource
Returns:
Formatted string

getFrameworkNodeHostname

public java.lang.String getFrameworkNodeHostname()
Gets the value of "framework.node.hostname" property

Returns:
Returns value of framework.node.hostname property

getFrameworkNodeName

public java.lang.String getFrameworkNodeName()
Gets the value of "framework.node.name" property

Returns:
Returns value of framework.node.name property

createFrameworkNode

public NodeEntryImpl createFrameworkNode()
Generate a node entry for the framework with default values

Returns:

filterNodes

public java.util.Collection<INodeEntry> filterNodes(NodesSelector nodeset,
                                                    java.lang.String project,
                                                    java.io.File nodesFile)
                                             throws NodeFileParserException
Read the nodes file for a project and return a filtered set of nodes

Parameters:
nodeset - node filter set
project - project name
Returns:
filtered set of nodes
Throws:
NodeFileParserException

filterNodeSet

public INodeSet filterNodeSet(NodesSelector nodeset,
                              java.lang.String project,
                              java.io.File nodesFile)
                       throws NodeFileParserException
Read the nodes file for a project and return a filtered set of nodes

Parameters:
nodeset - node filter set
project - project name
Returns:
filtered set of nodes
Throws:
NodeFileParserException

filterAuthorizedNodes

public INodeSet filterAuthorizedNodes(java.lang.String project,
                                      java.util.Set<java.lang.String> actions,
                                      INodeSet unfiltered)
Return the nodeset consisting only of the input nodes where the specified actions are all authorized


getConfigDir

public java.io.File getConfigDir()

getLibextDir

public java.io.File getLibextDir()
Return the directory containing plugins/extensions for the framework.


getLibextCacheDir

public java.io.File getLibextCacheDir()
Return the cache directory used by the plugin system


getFrameworkProjectsBaseDir

public java.io.File getFrameworkProjectsBaseDir()

setAuthorizationMgr

public void setAuthorizationMgr(LegacyAuthorization authorizationMgr)

setAuthenticationMgr

public void setAuthenticationMgr(Authenticator authenticationMgr)

getHomeDir

public java.io.File getHomeDir()

getNodeDesc

public INodeDesc getNodeDesc()
Gets the INodeDesc value describing the framework node

Returns:
the singleton INodeDesc object for this framework instance

isLocalNode

public boolean isLocalNode(INodeDesc node)
Return true if the node is the local framework node. Compares the (logical) node names of the nodes after eliding any embedded 'user@' parts.

Parameters:
node - the node
Returns:
true if the node's name is the same as the framework's node name