Class Project

    • Field Detail

      • CACHE

        private static final java.util.Map<java.lang.String,​Project> CACHE
      • base

        private java.io.File base
      • empty

        private boolean empty
      • name

        private java.lang.String name
    • Constructor Detail

      • Project

        public Project()
        Creates an empty project without scanning. Just for testing.
      • Project

        public Project​(java.io.File base,
                       ProgressObserver observer)
                throws VilException
        Creates a project for a given base directory.
        Parameters:
        base - the base directory (shall be an absolute path)
        observer - to notify the caller in case of long-running scans
        Throws:
        VilException - in case that the creation of artifacts fails
      • Project

        public Project​(Project project,
                       ProgressObserver observer)
                throws VilException
        Creates a new project by for the base directory given in project. Please note that this constructor is intended to be called to re-instantiate project after release() has been called on project. Thereby, the instance created by this constructor is fully initialized with a artifact model and, dependent on project, also an artifact scan is executed. This constructor is mainly intended to allow testing based on the VIL execution visitor and the VIL executor afterwards in sequence.
        Parameters:
        project - the project the data shall be taken from
        observer - to notify the caller in case of long-running scans
        Throws:
        VilException - in case that the creation of artifacts fails
      • Project

        private Project​(IProjectDescriptor descriptor,
                        ProgressObserver observer)
                 throws VilException
        Creates a project based on a given descriptor.
        Parameters:
        descriptor - the descriptor to create the project for
        observer - to notify the caller in case of long-running scans
        Throws:
        VilException - in case that the creation of artifacts fails
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the project.
        Returns:
        the name of the project
      • selectAllFiles

        public Set<FileArtifact> selectAllFiles()
        Returns all files.
        Returns:
        all files
      • selectAllFolders

        public Set<FolderArtifact> selectAllFolders()
        Returns all folders.
        Returns:
        all folders
      • getPath

        public Path getPath()
        Returns the path of this project.
        Returns:
        the path
      • localize

        public Path localize​(Project source,
                             Path path)
        Localizes the given path taken from source with respect to this project.
        Parameters:
        source - the source project
        path - the target path
        Returns:
        the localized path
      • localize

        public Path localize​(Project source,
                             IFileSystemArtifact artifact)
                      throws VilException
        Localizes the given path taken from source with respect to this project.
        Parameters:
        source - the source project
        artifact - the target artifact
        Returns:
        the localized path
        Throws:
        VilException - in case that localization is not possible due to artifact
      • getLocalProjectArtifacts

        public Set<FileArtifact> getLocalProjectArtifacts()
        Returns the local project artifacts.
        Returns:
        the local artifacts
      • selectByType

        public Set<FileArtifact> selectByType​(java.lang.Class<?> type)
        Does type selection of artifacts type equality.
        Parameters:
        type - the target type
        Returns:
        the selected artifacts (the type will be adjusted to the actual type of type)
      • selectByKind

        public Set<FileArtifact> selectByKind​(java.lang.Class<?> type)
        Does type selection of artifacts by type or sub-type.
        Parameters:
        type - the target type
        Returns:
        the selected artifacts (the type will be adjusted to the actual type of type)
      • typeReject

        public Set<FileArtifact> typeReject​(java.lang.Class<?> type)
        Does type selection of artifacts by not matching type or sub-type.
        Parameters:
        type - the target type
        Returns:
        the selected artifacts (the type will be adjusted to the actual type of type)
      • selectByName

        public Set<FileArtifact> selectByName​(java.lang.String name)
        Does name selection of artifacts.
        Parameters:
        name - the regular name pattern for artifact selection
        Returns:
        the selected artifacts
      • getProjectFor

        public static Project getProjectFor​(IProjectDescriptor descriptor)
                                     throws VilException
        Returns a cached project or caches a new one for descriptor. This method shall only be called on the root successor as caching will only work there!
        Parameters:
        descriptor - the descriptor to return the project for
        Returns:
        the related project
        Throws:
        VilException - in case that creating / scanning the project base fails
      • clearProjectDescriptorCache

        public static void clearProjectDescriptorCache()
        Clears the project descriptor cache. Handle with care and do not call this during a VIL execution!
      • predecessors

        public Set<Project> predecessors()
                                  throws VilException
        Returns the predecessors of this project.
        Returns:
        the predecessors
        Throws:
        VilException - in case that creating / scanning the project base fails
      • getStringValue

        public java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
        Description copied from interface: IStringValueProvider
        Returns the string value of this object.
        Specified by:
        getStringValue in interface IStringValueProvider
        Parameters:
        comparator - if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned
        Returns:
        the string value
      • getEasyFolder

        public Path getEasyFolder()
        Returns the path to the EASy files.
        Returns:
        the path to the EASy files
      • getIvmlFolder

        public Path getIvmlFolder()
        Returns the path to the IVML model files.
        Returns:
        the path to the IVML model files
      • getVilFolder

        public Path getVilFolder()
        Returns the path to the VIL model files.
        Returns:
        the path to the VIL model files
      • getVtlFolder

        public Path getVtlFolder()
        Returns the path to the VTL model files.
        Returns:
        the path to the VTL model files
      • createPathWithFallback

        private Path createPathWithFallback​(IProjectDescriptor.ModelKind kind)
        Creates a model path with default fallback.
        Parameters:
        kind - the kind of the models
        Returns:
        the path
      • release

        public void release()
        Releases this instance and the related artifact model.
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • getArtifactModel

        public ArtifactModel getArtifactModel()
        Returns the underlying artifact model.
        Returns:
        the underlying artifact model
      • convert

        public static Path convert​(Project project)
        Converts a project to its base path.
        Parameters:
        project - the project to be converted
        Returns:
        the base path of project
      • getMainVilScript

        public Script getMainVilScript()
        Returns the main VIL script of the project.
        Returns:
        the main VIL script
      • setSettings

        public void setSettings​(ProjectSettings key,
                                java.lang.Object object)
        Sets the settings for the artifact model.
        Parameters:
        key - ID for the settings object
        object - the settings
      • getSettings

        public java.lang.Object getSettings​(ProjectSettings key)
        Returns the settings object for the specified key.
        Parameters:
        key - the key assigned to the settings object
        Returns:
        the settings object