com.dtolabs.rundeck.core.common
Class FrameworkResourceParent

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

public abstract class FrameworkResourceParent
extends FrameworkResource
implements IFrameworkResourceParent

Provides capability of managing child FrameworkResource instances.


Nested Class Summary
static class FrameworkResourceParent.NoSuchResourceException
           
 
Field Summary
 
Fields inherited from class com.dtolabs.rundeck.core.common.FrameworkResource
VALID_RESOURCE_NAME_REGEX
 
Constructor Summary
FrameworkResourceParent(java.lang.String name, java.io.File dir, IFrameworkResourceParent parent)
          Constructor
 
Method Summary
 boolean childCouldBeLoaded(java.lang.String name)
          Default implementation checks whether a subdir under the basedir exists with the specified name.
 IFrameworkResource createChild(java.lang.String name)
          create a new child resource
 boolean existsChild(java.lang.String name)
          Checks if there is a child FrameworkResource with specified name.
 boolean existsChildResourceDirectory(java.lang.String name)
          Given a child resource name, checks if a subdirectory by that name exists
 IFrameworkResource getChild(java.lang.String name)
          Gets requested child FrameworkResource.
protected  java.util.Map getChildren()
           
 void initialize()
          Initializes state from any loaded children.
 java.util.Collection listChildNames()
          Default implementation lists the subdirectory names and adds any existing child names
 java.util.Collection listChildren()
          Returns a collection of FrameworkResource child resources.
 void remove(java.lang.String name)
          Remove the FrameworkResourceInstance by its name.
 
Methods inherited from class com.dtolabs.rundeck.core.common.FrameworkResource
getBaseDir, getLogger, getName, getParent, isValid, storeProperties, toString
 
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.IFrameworkResourceParent
loadChild
 
Methods inherited from interface com.dtolabs.rundeck.core.common.IFrameworkResource
getBaseDir, getName, getParent, isValid
 

Constructor Detail

FrameworkResourceParent

public FrameworkResourceParent(java.lang.String name,
                               java.io.File dir,
                               IFrameworkResourceParent parent)
Constructor

Parameters:
name - Name of resource
dir - Base directory of resource
Method Detail

createChild

public IFrameworkResource createChild(java.lang.String name)
create a new child resource

Specified by:
createChild in interface IFrameworkResourceParent
Parameters:
name - name of child
Returns:
new child

getChild

public IFrameworkResource getChild(java.lang.String name)
Gets requested child FrameworkResource. Throws a FrameworkResourceException if not found.

Specified by:
getChild in interface IFrameworkResourceParent
Parameters:
name -
Returns:

getChildren

protected java.util.Map getChildren()

existsChild

public boolean existsChild(java.lang.String name)
Checks if there is a child FrameworkResource with specified name.

Specified by:
existsChild in interface IFrameworkResourceParent
Parameters:
name -
Returns:

listChildren

public java.util.Collection listChildren()
Returns a collection of FrameworkResource child resources.

Specified by:
listChildren in interface IFrameworkResourceParent
Returns:

remove

public void remove(java.lang.String name)
Remove the FrameworkResourceInstance by its name.

Specified by:
remove in interface IFrameworkResourceParent
Parameters:
name - Name of object

initialize

public void initialize()
Initializes state from any loaded children. This implementation does nothing.

Specified by:
initialize in interface IFrameworkResourceParent

listChildNames

public java.util.Collection listChildNames()
Default implementation lists the subdirectory names and adds any existing child names

Specified by:
listChildNames in interface IFrameworkResourceParent
Returns:

childCouldBeLoaded

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

Specified by:
childCouldBeLoaded in interface IFrameworkResourceParent
Parameters:
name -
Returns:

existsChildResourceDirectory

public boolean existsChildResourceDirectory(java.lang.String name)
Given a child resource name, checks if a subdirectory by that name exists

Specified by:
existsChildResourceDirectory in interface IFrameworkResourceParent
Parameters:
name - Child resource name
Returns:
true if the directory exists