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,
IRundeckProjectConfig projectConfig,
IRundeckProjectConfigModifier projectConfigModifier)
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,
IProjectNodesFactory nodesFactory) |
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
|
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,
java.util.Properties properties,
boolean addDefault) |
java.util.Date |
getConfigLastModifiedTime() |
java.io.File |
getEtcDir()
Gets the config dir for this project
|
Framework |
getFramework() |
IFrameworkProjectMgr |
getFrameworkProjectMgr() |
IProjectInfo |
getInfo() |
INodeSet |
getNodeSet()
Returns the set of nodes for the project
|
Authorization |
getProjectAuthorization() |
static java.io.File |
getProjectEtcDir(java.io.File baseDir)
Get the etc dir from the basedir
|
IProjectNodes |
getProjectNodes() |
java.util.Map<java.lang.String,java.lang.String> |
getProjectProperties() |
static java.io.File |
getProjectPropertyFile(java.io.File baseDir)
Get the project property file from the basedir
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties() |
java.lang.String |
getProperty(java.lang.String name) |
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<java.lang.String> |
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 |
setProjectNodesFactory(IProjectNodesFactory projectNodesFactory) |
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, IRundeckProjectConfig projectConfig, IRundeckProjectConfigModifier projectConfigModifier)
name
- Name of the projectbasedir
- the base directory for the DepotresourceMgr
- managerprojectConfig
- configpublic static java.util.Set<Attribute> authorizationEnvironment(java.lang.String project)
project
- project namepublic IProjectInfo getInfo()
getInfo
in interface IRundeckProject
public static java.io.File getProjectEtcDir(java.io.File baseDir)
public static java.io.File getProjectPropertyFile(java.io.File baseDir)
public java.lang.String getProperty(java.lang.String name)
getProperty
in interface IRundeckProject
getProperty
in interface IRundeckProjectConfig
name
- property namepublic boolean hasProperty(java.lang.String key)
hasProperty
in interface IRundeckProject
hasProperty
in interface IRundeckProjectConfig
key
- property namepublic java.util.Map<java.lang.String,java.lang.String> getProperties()
getProperties
in interface IRundeckProject
getProperties
in interface IRundeckProjectConfig
public java.util.Map<java.lang.String,java.lang.String> getProjectProperties()
getProjectProperties
in interface IRundeckProject
getProjectProperties
in interface IRundeckProjectConfig
public java.util.Date getConfigLastModifiedTime()
getConfigLastModifiedTime
in interface IRundeckProject
getConfigLastModifiedTime
in interface IRundeckProjectConfig
public 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, IProjectNodesFactory nodesFactory)
name
- project nameprojectsDir
- projects dirresourceMgr
- resourcemanagerpublic static FrameworkProject create(java.lang.String name, java.io.File projectsDir, FilesystemFramework filesystemFramework, IFrameworkProjectMgr resourceMgr)
name
- project nameprojectsDir
- projects dirresourceMgr
- resourcemanagerpublic 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<java.lang.String> 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 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 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, java.util.Properties properties, boolean addDefault)
public 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 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 Authorization getProjectAuthorization()
getProjectAuthorization
in interface IRundeckProject
public void setProjectAuthorization(Authorization projectAuthorization)
public void setProjectNodesFactory(IProjectNodesFactory projectNodesFactory)