public class FrameworkProject extends FrameworkResourceParent implements IRundeckProject
FrameworkResourceParent.NoSuchResourceException
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ETC_DIR_NAME |
static java.lang.String |
FRAMEWORK_RESOURCES_ALLOWED_URL_PREFIX |
static java.lang.String |
NODES_XML |
static java.lang.String |
PROJECT_RESOURCES_ALLOWED_URL_PREFIX |
static java.lang.String |
PROJECT_RESOURCES_FILE_PROPERTY |
static java.lang.String |
PROJECT_RESOURCES_FILEFORMAT_PROPERTY |
static java.lang.String |
PROJECT_RESOURCES_MERGE_NODE_ATTRIBUTES |
static java.lang.String |
PROJECT_RESOURCES_URL_PROPERTY |
static java.lang.String |
PROP_FILENAME |
static java.lang.String |
RESOURCES_SOURCE_PROP_PREFIX |
VALID_RESOURCE_NAME_CHARSET_REGEX, VALID_RESOURCE_NAME_REGEX
Constructor and Description |
---|
FrameworkProject(java.lang.String name,
java.io.File basedir,
FilesystemFramework filesystemFramework,
IFrameworkProjectMgr resourceMgr)
Constructor
|
FrameworkProject(java.lang.String name,
java.io.File basedir,
FilesystemFramework filesystemFramework,
IFrameworkProjectMgr resourceMgr,
java.util.Properties properties)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static java.util.Set<Attribute> |
authorizationEnvironment(java.lang.String project)
Creates an authorization environment for a project.
|
boolean |
childCouldBeLoaded(java.lang.String name)
Default implementation checks whether a subdir under the basedir exists with the specified name.
|
static FrameworkProject |
create(java.lang.String name,
java.io.File projectsDir,
FilesystemFramework filesystemFramework,
IFrameworkProjectMgr resourceMgr) |
static FrameworkProject |
create(java.lang.String name,
java.io.File projectsDir,
FilesystemFramework filesystemFramework,
IFrameworkProjectMgr resourceMgr,
java.util.Properties properties) |
IFrameworkResource |
createChild(java.lang.String resourceType)
Create a new type and store it
|
static void |
createFileStructure(java.io.File projectDir)
Creates the file structure for a project
|
static PropertyRetriever |
createProjectPropertyRetriever(FilesystemFramework filesystemFramework,
java.lang.String projectName) |
boolean |
deleteFileResource(java.lang.String path) |
static boolean |
exists(java.lang.String project,
IFrameworkProjectMgr projectResourceMgr) |
boolean |
existsDirResource(java.lang.String path) |
boolean |
existsFileResource(java.lang.String path) |
protected void |
generateProjectPropertiesFile(boolean overwrite)
Create project.properties file based on $RDECK_BASE/etc/project.properties
|
protected void |
generateProjectPropertiesFile(boolean overwrite,
java.util.Properties properties,
boolean addDefaultProps)
Create project.properties file based on $RDECK_BASE/etc/project.properties
|
protected void |
generateProjectPropertiesFile(boolean overwrite,
java.util.Properties properties,
boolean merge,
java.util.Set<java.lang.String> removePrefixes,
boolean addDefaultProps)
Create project.properties file based on $RDECK_BASE/etc/project.properties
|
java.util.Date |
getConfigLastModifiedTime() |
java.io.File |
getEtcDir()
Gets the config dir for this project
|
Framework |
getFramework() |
IFrameworkProjectMgr |
getFrameworkProjectMgr() |
INodeSet |
getNodeSet()
Returns the set of nodes for the project
|
Authorization |
getProjectAuthorization() |
IProjectNodes |
getProjectNodes() |
java.util.Map<java.lang.String,java.lang.String> |
getProjectProperties() |
java.util.Map<java.lang.String,java.lang.String> |
getProperties() |
java.lang.String |
getProperty(java.lang.String name) |
java.io.File |
getPropertyFile() |
PropertyRetriever |
getPropertyRetriever() |
java.util.ArrayList<java.lang.Exception> |
getResourceModelSourceExceptions() |
boolean |
hasProperty(java.lang.String key) |
static boolean |
isInstalled(FrameworkProject d)
Checks if project is installed by checking if it's basedir directory exists.
|
java.util.Collection |
listChildNames()
Default implementation lists the subdirectory names and adds any existing child names
|
java.util.List<java.lang.String> |
listDirPaths(java.lang.String path) |
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
listResourceModelConfigurations()
list the configurations of resource model providers.
|
IFrameworkResource |
loadChild(java.lang.String name) |
long |
loadFileResource(java.lang.String path,
java.io.OutputStream output)
Read a file at a path for the project
|
void |
mergeProjectProperties(java.util.Properties properties,
java.util.Set<java.lang.String> removePrefixes)
Update the project properties file by setting updating the given properties, and removing
any properties that have a prefix in the removePrefixes set
|
void |
setFramework(Framework framework) |
void |
setProjectAuthorization(Authorization projectAuthorization) |
void |
setProjectNodes(IProjectNodes projectNodes) |
void |
setProjectProperties(java.util.Properties properties)
Set the project properties file contents exactly
|
long |
storeFileResource(java.lang.String path,
java.io.InputStream input)
Store a file at a path for the project
|
boolean |
updateNodesResourceFile()
Conditionally update the nodes resources file if a URL source is defined for it and return
true if the update process was invoked and succeeded
|
void |
updateNodesResourceFile(INodeSet nodeset)
Update the resources file given an input Nodes set
|
void |
updateNodesResourceFileFromUrl(java.lang.String providerURL,
java.lang.String username,
java.lang.String password)
Update the nodes resources file from a specific URL, with BASIC authentication as provided or
as defined in the URL's userInfo section.
|
existsChild, existsChildResourceDirectory, getChild, getChildren, initialize, listChildren, remove
getBaseDir, getLogger, getName, getParent, isValid, storeProperties, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
getBaseDir, getName, getParent, isValid
public static final java.lang.String PROP_FILENAME
public static final java.lang.String ETC_DIR_NAME
public static final java.lang.String NODES_XML
public static final java.lang.String PROJECT_RESOURCES_URL_PROPERTY
public static final java.lang.String PROJECT_RESOURCES_FILE_PROPERTY
public static final java.lang.String PROJECT_RESOURCES_FILEFORMAT_PROPERTY
public static final java.lang.String PROJECT_RESOURCES_ALLOWED_URL_PREFIX
public static final java.lang.String FRAMEWORK_RESOURCES_ALLOWED_URL_PREFIX
public static final java.lang.String RESOURCES_SOURCE_PROP_PREFIX
public static final java.lang.String PROJECT_RESOURCES_MERGE_NODE_ATTRIBUTES
public FrameworkProject(java.lang.String name, java.io.File basedir, FilesystemFramework filesystemFramework, IFrameworkProjectMgr resourceMgr)
name
- Name of the projectbasedir
- the base directory for the DepotresourceMgr
- managerpublic FrameworkProject(java.lang.String name, java.io.File basedir, FilesystemFramework filesystemFramework, IFrameworkProjectMgr resourceMgr, java.util.Properties properties)
name
- Name of the projectbasedir
- the base directory for the DepotresourceMgr
- managerproperties
- propertiespublic static java.util.Set<Attribute> authorizationEnvironment(java.lang.String project)
project
- project namepublic static PropertyRetriever createProjectPropertyRetriever(FilesystemFramework filesystemFramework, java.lang.String projectName)
filesystemFramework
- filesystemprojectName
- name of projectpublic java.util.List<java.util.Map<java.lang.String,java.lang.Object>> listResourceModelConfigurations()
listResourceModelConfigurations
in interface IRundeckProject
public static FrameworkProject create(java.lang.String name, java.io.File projectsDir, FilesystemFramework filesystemFramework, IFrameworkProjectMgr resourceMgr)
name
- project nameprojectsDir
- projects dirresourceMgr
- resourcemanagerpublic static FrameworkProject create(java.lang.String name, java.io.File projectsDir, FilesystemFramework filesystemFramework, IFrameworkProjectMgr resourceMgr, java.util.Properties properties)
name
- project nameprojectsDir
- projects dirresourceMgr
- resourcemanagerproperties
- project propertiespublic IFrameworkResource loadChild(java.lang.String name)
loadChild
in interface IFrameworkResourceParent
name
- child namepublic boolean childCouldBeLoaded(java.lang.String name)
FrameworkResourceParent
FrameworkResourceParent.existsChildResourceDirectory(String)
)
Should be overridden by subtypes if this is not the desired behavior.childCouldBeLoaded
in interface IFrameworkResourceParent
childCouldBeLoaded
in class FrameworkResourceParent
name
- child namepublic java.util.Collection listChildNames()
FrameworkResourceParent
listChildNames
in interface IFrameworkResourceParent
listChildNames
in class FrameworkResourceParent
public IFrameworkResource createChild(java.lang.String resourceType)
createChild
in interface IFrameworkResourceParent
createChild
in class FrameworkResourceParent
resourceType
- name of childpublic java.io.File getPropertyFile()
public IFrameworkProjectMgr getFrameworkProjectMgr()
public static boolean exists(java.lang.String project, IFrameworkProjectMgr projectResourceMgr)
public java.io.File getEtcDir()
public INodeSet getNodeSet() throws NodeFileParserException
getNodeSet
in interface IRundeckProject
INodeSet
NodeFileParserException
- on parse errorpublic boolean updateNodesResourceFile() throws UpdateUtils.UpdateException
updateNodesResourceFile
in interface IRundeckProject
UpdateUtils.UpdateException
- if an error occurs while trying to update the resources filepublic void updateNodesResourceFileFromUrl(java.lang.String providerURL, java.lang.String username, java.lang.String password) throws UpdateUtils.UpdateException
updateNodesResourceFileFromUrl
in interface IRundeckProject
providerURL
- URL to retrieve resources file definitionusername
- username or nullpassword
- or nullUpdateUtils.UpdateException
- if an error occurs during the update processpublic void updateNodesResourceFile(INodeSet nodeset) throws UpdateUtils.UpdateException
updateNodesResourceFile
in interface IRundeckProject
nodeset
- nodesUpdateUtils.UpdateException
- if an error occurs while trying to update the resources file or generate
nodespublic java.lang.String getProperty(java.lang.String name)
getProperty
in interface IRundeckProject
name
- property namepublic boolean hasProperty(java.lang.String key)
hasProperty
in interface IRundeckProject
public java.util.Map<java.lang.String,java.lang.String> getProperties()
getProperties
in interface IRundeckProject
public java.util.Map<java.lang.String,java.lang.String> getProjectProperties()
getProjectProperties
in interface IRundeckProject
public PropertyRetriever getPropertyRetriever()
public static void createFileStructure(java.io.File projectDir) throws java.io.IOException
projectDir
- The project base directoryjava.io.IOException
- on io errorpublic boolean existsFileResource(java.lang.String path)
existsFileResource
in interface IRundeckProject
path
- path relative to the projectpublic boolean existsDirResource(java.lang.String path)
existsDirResource
in interface IRundeckProject
path
- path relative to the projectpublic java.util.List<java.lang.String> listDirPaths(java.lang.String path)
listDirPaths
in interface IRundeckProject
path
- path relative to the projectpublic boolean deleteFileResource(java.lang.String path)
deleteFileResource
in interface IRundeckProject
path
- path relative to the projectpublic long storeFileResource(java.lang.String path, java.io.InputStream input) throws java.io.IOException
IRundeckProject
storeFileResource
in interface IRundeckProject
path
- path relative to the projectinput
- inputjava.io.IOException
- if an IO error occurspublic long loadFileResource(java.lang.String path, java.io.OutputStream output) throws java.io.IOException
IRundeckProject
loadFileResource
in interface IRundeckProject
path
- path relative to the projectoutput
- outputjava.io.IOException
- if an IO error occursprotected void generateProjectPropertiesFile(boolean overwrite)
overwrite
- Overwrite existing properties fileprotected void generateProjectPropertiesFile(boolean overwrite, java.util.Properties properties, boolean addDefaultProps)
overwrite
- Overwrite existing properties fileproperties
- propertiesaddDefaultProps
- true to add default propertiesprotected void generateProjectPropertiesFile(boolean overwrite, java.util.Properties properties, boolean merge, java.util.Set<java.lang.String> removePrefixes, boolean addDefaultProps)
overwrite
- Overwrite existing properties fileproperties
- properties to usemerge
- if true, merge existing properties that are not replacedremovePrefixes
- set of property prefixes to remove from originaladdDefaultProps
- true to add default propertiespublic void mergeProjectProperties(java.util.Properties properties, java.util.Set<java.lang.String> removePrefixes)
mergeProjectProperties
in interface IRundeckProject
properties
- new properties to put in the fileremovePrefixes
- prefixes of properties to remove from the filepublic void setProjectProperties(java.util.Properties properties)
setProjectProperties
in interface IRundeckProject
properties
- new properties to use in the filepublic java.util.Date getConfigLastModifiedTime()
getConfigLastModifiedTime
in interface IRundeckProject
public static boolean isInstalled(FrameworkProject d)
d
- Depot object to check.public java.util.ArrayList<java.lang.Exception> getResourceModelSourceExceptions()
public Framework getFramework()
public void setFramework(Framework framework)
public IProjectNodes getProjectNodes()
getProjectNodes
in interface IRundeckProject
public void setProjectNodes(IProjectNodes projectNodes)
public Authorization getProjectAuthorization()
getProjectAuthorization
in interface IRundeckProject
public void setProjectAuthorization(Authorization projectAuthorization)