Class FrameworkProject

    • Field Detail

      • RESOURCES_SOURCE_PROP_PREFIX

        public static final java.lang.String RESOURCES_SOURCE_PROP_PREFIX
        See Also:
        Constant Field Values
      • PROJECT_RESOURCES_MERGE_NODE_ATTRIBUTES

        public static final java.lang.String PROJECT_RESOURCES_MERGE_NODE_ATTRIBUTES
        See Also:
        Constant Field Values
      • PROJECT_ATTR_URI

        public static final java.net.URI PROJECT_ATTR_URI
    • Method Detail

      • authorizationEnvironment

        public static java.util.Set<com.dtolabs.rundeck.core.authorization.Attribute> authorizationEnvironment​(java.lang.String project)
        Creates an authorization environment for a project.
        Parameters:
        project - project name
        Returns:
        environment to evaluate authorization for a project
      • isProjectEnvironment

        public static boolean isProjectEnvironment​(java.util.Set<com.dtolabs.rundeck.core.authorization.Attribute> env)
      • getProjectEnvironment

        public static java.util.Optional<java.lang.String> getProjectEnvironment​(java.util.Set<com.dtolabs.rundeck.core.authorization.Attribute> env)
      • getProjectEtcDir

        public static java.io.File getProjectEtcDir​(java.io.File baseDir)
        Get the etc dir from the basedir
      • getProjectPropertyFile

        public static java.io.File getProjectPropertyFile​(java.io.File baseDir)
        Get the project property file from the basedir
      • listResourceModelConfigurations

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> listResourceModelConfigurations()
        list the configurations of resource model providers.
        Specified by:
        listResourceModelConfigurations in interface IRundeckProject
        Returns:
        a list of maps containing:
        • type - provider type name
        • props - configuration properties
      • create

        public static FrameworkProject create​(java.lang.String name,
                                              java.io.File projectsDir,
                                              IFilesystemFramework filesystemFramework,
                                              IFrameworkProjectMgr resourceMgr,
                                              java.util.function.Supplier<ResourceFormatGeneratorService> getResourceFormatGeneratorService,
                                              java.util.function.Supplier<ResourceModelSourceService> getResourceModelSourceService)
        Parameters:
        getResourceFormatGeneratorService -
        getResourceModelSourceService -
        name - project name
        projectsDir - projects dir
        resourceMgr - resourcemanager
        Returns:
        Create a new Project object at the specified projects.directory
      • childCouldBeLoaded

        public boolean childCouldBeLoaded​(java.lang.String name)
      • listChildNames

        public java.util.Collection<java.lang.String> listChildNames()
      • exists

        public static boolean exists​(java.lang.String project,
                                     IFrameworkProjectMgr projectResourceMgr)
      • getEtcDir

        public java.io.File getEtcDir()
        Gets the config dir for this project
        Returns:
        etc directory
      • createFileStructure

        public static void createFileStructure​(java.io.File projectDir)
                                        throws java.io.IOException
        Creates the file structure for a project
        Parameters:
        projectDir - The project base directory
        Throws:
        java.io.IOException - on io error
      • existsFileResource

        public boolean existsFileResource​(java.lang.String path)
        Specified by:
        existsFileResource in interface IRundeckProject
        Parameters:
        path - path relative to the project
        Returns:
        true if it exists
      • existsDirResource

        public boolean existsDirResource​(java.lang.String path)
        Specified by:
        existsDirResource in interface IRundeckProject
        Parameters:
        path - path relative to the project
        Returns:
        true if it is a directory
      • listDirPaths

        public java.util.List<java.lang.String> listDirPaths​(java.lang.String path)
        Specified by:
        listDirPaths in interface IRundeckProject
        Parameters:
        path - path relative to the project
        Returns:
        list of paths within the directory
      • deleteFileResource

        public boolean deleteFileResource​(java.lang.String path)
        Specified by:
        deleteFileResource in interface IRundeckProject
        Parameters:
        path - path relative to the project
        Returns:
        true if it is deleted, false if it was not deleted
      • storeFileResource

        public long storeFileResource​(java.lang.String path,
                                      java.io.InputStream input)
                               throws java.io.IOException
        Description copied from interface: IRundeckProject
        Store a file at a path for the project
        Specified by:
        storeFileResource in interface IRundeckProject
        Parameters:
        path - path relative to the project
        input - input
        Throws:
        java.io.IOException - if an IO error occurs
      • loadFileResource

        public long loadFileResource​(java.lang.String path,
                                     java.io.OutputStream output)
                              throws java.io.IOException
        Description copied from interface: IRundeckProject
        Read a file at a path for the project
        Specified by:
        loadFileResource in interface IRundeckProject
        Parameters:
        path - path relative to the project
        output - output
        Returns:
        length of data loaded
        Throws:
        java.io.IOException - if an IO error occurs
      • generateProjectPropertiesFile

        protected void generateProjectPropertiesFile​(boolean overwrite,
                                                     java.util.Properties properties,
                                                     boolean addDefault)
      • mergeProjectProperties

        public 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
        Specified by:
        mergeProjectProperties in interface IRundeckProject
        Parameters:
        properties - new properties to put in the file
        removePrefixes - prefixes of properties to remove from the file
      • setProjectProperties

        public void setProjectProperties​(java.util.Properties properties)
        Set the project properties file contents exactly
        Specified by:
        setProjectProperties in interface IRundeckProject
        Parameters:
        properties - new properties to use in the file
      • isInstalled

        public static boolean isInstalled​(FrameworkProject d)
        Checks if project is installed by checking if it's basedir directory exists.
        Parameters:
        d - Depot object to check.
        Returns:
        true if project exists
      • getResourceModelSourceExceptions

        public java.util.ArrayList<java.lang.Throwable> getResourceModelSourceExceptions()
        Returns:
        the set of exceptions produced by the last attempt to invoke all node providers
      • setProjectNodesFactory

        public void setProjectNodesFactory​(IProjectNodesFactory projectNodesFactory)