Package com.dtolabs.rundeck.core.common
Class FrameworkBase
- java.lang.Object
-
- com.dtolabs.rundeck.core.common.FrameworkBase
-
- All Implemented Interfaces:
IExecutionProviders
,IExecutionServices
,IFramework
,IFrameworkNodes
,IFrameworkServices
,IServicesRegistration
- Direct Known Subclasses:
Framework
public class FrameworkBase extends java.lang.Object implements IFramework
Manages the elements of the Ctl framework. Provides access to the various kinds of framework resource managers likeFrameworkProjectMgr
,Authorization
.
User: alexh Date: Jun 4, 2004 Time: 8:16:42 PM
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FRAMEWORK_GLOBALS_PROP
static org.slf4j.Logger
logger
static java.lang.String
NODES_RESOURCES_FILE_PROP
static java.lang.String
PROJECT_GLOBALS_PROP
-
Constructor Summary
Constructors Constructor Description FrameworkBase(ProjectManager projectManager, IPropertyLookup lookup, IFrameworkServices services, IFrameworkNodes iFrameworkNodes)
Standard constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeEntryImpl
createFrameworkNode()
static PropertyRetriever
createPropertyRetriever(java.io.File basedir)
INodeSet
filterAuthorizedNodes(java.lang.String project, java.util.Set<java.lang.String> actions, INodeSet unfiltered, com.dtolabs.rundeck.core.authorization.AuthContext authContext)
ExecutionService
getExecutionService()
FileCopier
getFileCopierForNodeAndProject(INodeEntry node, ExecutionContext context)
provide file copier for the node and projectFileCopierService
getFileCopierService()
java.lang.String
getFrameworkNodeHostname()
Gets the value of "framework.server.hostname" propertyjava.lang.String
getFrameworkNodeName()
Gets the value of "framework.server.name" propertyIFrameworkNodes
getFrameworkNodes()
ProjectManager
getFrameworkProjectMgr()
Gets DepotMgr for this framework instanceIFrameworkServices
getFrameworkServices()
static Framework
getInstance(java.lang.String basedir, java.lang.String projectsdir)
INodeDesc
getNodeDesc()
Gets theINodeDesc
value describing the framework nodeNodeDispatcher
getNodeDispatcherForContext(ExecutionContext context)
provide node dispatcher for contextNodeDispatcherService
getNodeDispatcherService()
NodeExecutor
getNodeExecutorForNodeAndProject(INodeEntry node, ExecutionContext context)
provide node executor for the node and projectNodeExecutorService
getNodeExecutorService()
NodeStepExecutor
getNodeStepExecutorForItem(NodeStepExecutionItem item, ExecutionContext context, INodeEntry node)
provide node step executor for item and projectNodeStepExecutionService
getNodeStepExecutorService()
OrchestratorService
getOrchestratorService()
ServiceProviderLoader
getPluginManager()
java.util.Map<java.lang.String,java.lang.String>
getProjectGlobals(java.lang.String project)
Retrieves the global properties defined for the specified project.ProjectManager
getProjectManager()
java.lang.String
getProjectProperty(java.lang.String project, java.lang.String key)
java.lang.String
getProperty(java.lang.String name)
Return the property value by nameIPropertyLookup
getPropertyLookup()
ResourceFormatGeneratorService
getResourceFormatGeneratorService()
ResourceFormatParserService
getResourceFormatParserService()
ResourceModelSourceService
getResourceModelSourceService()
FrameworkSupportService
getService(java.lang.String name)
StepExecutionService
getStepExecutionService()
StepExecutor
getStepExecutorForItem(StepExecutionItem item, java.lang.String project)
provide step executor for the item and the projectWorkflowExecutionService
getWorkflowExecutionService()
WorkflowStrategyService
getWorkflowStrategyService()
boolean
hasProjectProperty(java.lang.String key, java.lang.String project)
boolean
hasProperty(java.lang.String key)
void
initialize(Framework framework)
initializeboolean
isLocalNode(INodeDesc node)
Return true if the node is the local framework node.void
overrideService(java.lang.String name, FrameworkSupportService service)
Override existing registrationvoid
setFrameworkNodes(IFrameworkNodes frameworkNodes)
void
setFrameworkServices(IFrameworkServices frameworkServices)
void
setProjectManager(ProjectManager projectManager)
void
setService(java.lang.String name, FrameworkSupportService service)
Set a service by name if not yet set, will not override existing registrationjava.lang.String
toString()
Returns a string with useful information for debugging.-
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.IFramework
getPropertyRetriever
-
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
NODES_RESOURCES_FILE_PROP
public static final java.lang.String NODES_RESOURCES_FILE_PROP
- See Also:
- Constant Field Values
-
FRAMEWORK_GLOBALS_PROP
public static final java.lang.String FRAMEWORK_GLOBALS_PROP
- See Also:
- Constant Field Values
-
PROJECT_GLOBALS_PROP
public static final java.lang.String PROJECT_GLOBALS_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FrameworkBase
public FrameworkBase(ProjectManager projectManager, IPropertyLookup lookup, IFrameworkServices services, IFrameworkNodes iFrameworkNodes)
Standard constructor
-
-
Method Detail
-
initialize
public void initialize(Framework framework)
Description copied from interface:IFrameworkServices
initialize- Specified by:
initialize
in interfaceIFrameworkServices
-
getFrameworkProjectMgr
public ProjectManager getFrameworkProjectMgr()
Gets DepotMgr for this framework instance- Specified by:
getFrameworkProjectMgr
in interfaceIFramework
- Returns:
- returns instance of IFrameworkProjectMgr
-
getService
public FrameworkSupportService getService(java.lang.String name)
- Specified by:
getService
in interfaceIServicesRegistration
- Parameters:
name
- service name- Returns:
- a service by name
-
overrideService
public void overrideService(java.lang.String name, FrameworkSupportService service)
Description copied from interface:IServicesRegistration
Override existing registration- Specified by:
overrideService
in interfaceIServicesRegistration
- Parameters:
name
- nameservice
- service
-
setService
public void setService(java.lang.String name, FrameworkSupportService service)
Description copied from interface:IServicesRegistration
Set a service by name if not yet set, will not override existing registration- Specified by:
setService
in interfaceIServicesRegistration
- Parameters:
name
- nameservice
- service, or null to remove the registration
-
getStepExecutorForItem
public StepExecutor getStepExecutorForItem(StepExecutionItem item, java.lang.String project) throws ExecutionServiceException
Description copied from interface:IExecutionProviders
provide step executor for the item and the project- Specified by:
getStepExecutorForItem
in interfaceIExecutionProviders
- Returns:
- Throws:
ExecutionServiceException
-
getNodeDispatcherService
public NodeDispatcherService getNodeDispatcherService()
- Specified by:
getNodeDispatcherService
in interfaceIExecutionServices
-
getExecutionService
public ExecutionService getExecutionService()
- Specified by:
getExecutionService
in interfaceIFrameworkServices
-
getOrchestratorService
public OrchestratorService getOrchestratorService()
- Specified by:
getOrchestratorService
in interfaceIExecutionServices
-
getWorkflowExecutionService
public WorkflowExecutionService getWorkflowExecutionService()
- Specified by:
getWorkflowExecutionService
in interfaceIExecutionServices
-
getWorkflowStrategyService
public WorkflowStrategyService getWorkflowStrategyService()
- Specified by:
getWorkflowStrategyService
in interfaceIExecutionServices
-
getStepExecutionService
public StepExecutionService getStepExecutionService()
- Specified by:
getStepExecutionService
in interfaceIExecutionServices
-
getFileCopierForNodeAndProject
public FileCopier getFileCopierForNodeAndProject(INodeEntry node, ExecutionContext context) throws ExecutionServiceException
Description copied from interface:IExecutionProviders
provide file copier for the node and project- Specified by:
getFileCopierForNodeAndProject
in interfaceIExecutionProviders
- Returns:
- Throws:
ExecutionServiceException
-
getFileCopierService
public FileCopierService getFileCopierService()
- Specified by:
getFileCopierService
in interfaceIExecutionServices
-
getNodeExecutorForNodeAndProject
public NodeExecutor getNodeExecutorForNodeAndProject(INodeEntry node, ExecutionContext context) throws ExecutionServiceException
Description copied from interface:IExecutionProviders
provide node executor for the node and project- Specified by:
getNodeExecutorForNodeAndProject
in interfaceIExecutionProviders
- Returns:
- Throws:
ExecutionServiceException
-
getNodeExecutorService
public NodeExecutorService getNodeExecutorService()
- Specified by:
getNodeExecutorService
in interfaceIExecutionServices
-
getNodeStepExecutorService
public NodeStepExecutionService getNodeStepExecutorService()
- Specified by:
getNodeStepExecutorService
in interfaceIExecutionServices
-
getNodeStepExecutorForItem
public NodeStepExecutor getNodeStepExecutorForItem(NodeStepExecutionItem item, ExecutionContext context, INodeEntry node) throws ExecutionServiceException
Description copied from interface:IExecutionProviders
provide node step executor for item and project- Specified by:
getNodeStepExecutorForItem
in interfaceIExecutionProviders
- Returns:
- Throws:
ExecutionServiceException
-
getNodeDispatcherForContext
public NodeDispatcher getNodeDispatcherForContext(ExecutionContext context) throws ExecutionServiceException
Description copied from interface:IExecutionProviders
provide node dispatcher for context- Specified by:
getNodeDispatcherForContext
in interfaceIExecutionProviders
- Returns:
- Throws:
ExecutionServiceException
-
getResourceModelSourceService
public ResourceModelSourceService getResourceModelSourceService()
- Specified by:
getResourceModelSourceService
in interfaceIExecutionServices
-
getResourceFormatParserService
public ResourceFormatParserService getResourceFormatParserService()
- Specified by:
getResourceFormatParserService
in interfaceIExecutionServices
-
getResourceFormatGeneratorService
public ResourceFormatGeneratorService getResourceFormatGeneratorService()
- Specified by:
getResourceFormatGeneratorService
in interfaceIExecutionServices
-
getPluginManager
public ServiceProviderLoader getPluginManager()
- Specified by:
getPluginManager
in interfaceIFrameworkServices
-
createPropertyRetriever
public static PropertyRetriever createPropertyRetriever(java.io.File basedir)
-
getInstance
public static Framework getInstance(java.lang.String basedir, java.lang.String projectsdir)
-
getProperty
public java.lang.String getProperty(java.lang.String name)
Return the property value by name- Parameters:
name
- Property key- Returns:
- property value
-
hasProperty
public boolean hasProperty(java.lang.String key)
- Parameters:
key
- property key- Returns:
- true if the property exists
-
hasProjectProperty
public boolean hasProjectProperty(java.lang.String key, java.lang.String project)
- Parameters:
project
- projectkey
- property name- Returns:
- 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)
- Parameters:
project
- projectkey
- property name- Returns:
- the property value for the key from the project or framework properties if it exists, otherwise return null.
-
getProjectGlobals
public java.util.Map<java.lang.String,java.lang.String> getProjectGlobals(java.lang.String project)
Retrieves the global properties defined for the specified project. This variables are defined either in the framework (framework.globals.*) or in the project (project.globals.*). The prefix (xxx.globals.) will be stripped from the property name. For variables defines both in framework and project contexts, the variable defined in the project will have priority.- Parameters:
project
- The project identifier.- Returns:
- Map with global variables.
-
getPropertyLookup
public IPropertyLookup getPropertyLookup()
- Specified by:
getPropertyLookup
in interfaceIFramework
- Returns:
- property lookup
-
toString
public java.lang.String toString()
Returns a string with useful information for debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- Formatted string
-
getFrameworkNodeHostname
public java.lang.String getFrameworkNodeHostname()
Description copied from interface:IFramework
Gets the value of "framework.server.hostname" property- Specified by:
getFrameworkNodeHostname
in interfaceIFramework
- Specified by:
getFrameworkNodeHostname
in interfaceIFrameworkNodes
- Returns:
- Returns value of framework.server.hostname property
-
getFrameworkNodeName
public java.lang.String getFrameworkNodeName()
Description copied from interface:IFramework
Gets the value of "framework.server.name" property- Specified by:
getFrameworkNodeName
in interfaceIFramework
- Specified by:
getFrameworkNodeName
in interfaceIFrameworkNodes
- Returns:
- Returns value of framework.server.name property
-
createFrameworkNode
public NodeEntryImpl createFrameworkNode()
- Specified by:
createFrameworkNode
in interfaceIFramework
- Specified by:
createFrameworkNode
in interfaceIFrameworkNodes
- Returns:
- Generate a node entry for the framework with default values
-
filterAuthorizedNodes
public INodeSet filterAuthorizedNodes(java.lang.String project, java.util.Set<java.lang.String> actions, INodeSet unfiltered, com.dtolabs.rundeck.core.authorization.AuthContext authContext)
- Specified by:
filterAuthorizedNodes
in interfaceIFramework
- Specified by:
filterAuthorizedNodes
in interfaceIFrameworkNodes
- Parameters:
project
- project nameactions
- action setunfiltered
- nodesauthContext
- authoriziation- Returns:
- the nodeset consisting only of the input nodes where the specified actions are all authorized
-
getNodeDesc
public INodeDesc getNodeDesc()
Description copied from interface:IFramework
Gets theINodeDesc
value describing the framework node- Specified by:
getNodeDesc
in interfaceIFramework
- Specified by:
getNodeDesc
in interfaceIFrameworkNodes
- Returns:
- the singleton
INodeDesc
object for this framework instance
-
isLocalNode
public boolean isLocalNode(INodeDesc node)
Description copied from interface:IFramework
Return true if the node is the local framework node. Compares the (logical) node names of the nodes after eliding any embedded 'user@' parts.- Specified by:
isLocalNode
in interfaceIFramework
- Specified by:
isLocalNode
in interfaceIFrameworkNodes
- Parameters:
node
- the node- Returns:
- true if the node's name is the same as the framework's node name
-
getFrameworkServices
public IFrameworkServices getFrameworkServices()
-
setFrameworkServices
public void setFrameworkServices(IFrameworkServices frameworkServices)
-
getFrameworkNodes
public IFrameworkNodes getFrameworkNodes()
-
setFrameworkNodes
public void setFrameworkNodes(IFrameworkNodes frameworkNodes)
-
getProjectManager
public ProjectManager getProjectManager()
-
setProjectManager
public void setProjectManager(ProjectManager projectManager)
-
-