Class FileArtifact

    • Field Detail

      • path

        private Path path
      • isTemporary

        private boolean isTemporary
    • Constructor Detail

      • FileArtifact

        protected FileArtifact​(java.io.File file,
                               ArtifactModel model)
        Creates a new file artifact.
        Parameters:
        file - the physical file of this artifact
        model - the artifact model to create this folder artifact within
      • FileArtifact

        protected FileArtifact​(Path path,
                               ArtifactModel model)
        Creates a new file artifact.
        Parameters:
        path - the path representing this artifact
        model - the artifact model to create this folder artifact within
    • Method Detail

      • create

        public static FileArtifact create()
                                   throws VilException
        Creates a temporary file artifact.
        Returns:
        the created file artifact
        Throws:
        VilException - in case that the creation fails
      • isTemporary

        public boolean isTemporary()
        Returns whether this artifact is (considered to be) a temporary artifact.
        Specified by:
        isTemporary in interface IFileSystemArtifact
        Returns:
        true if it is temporary, false else
      • delete

        public void delete()
                    throws VilException
        Description copied from interface: IArtifact
        Deletes this artifact.
        Specified by:
        delete in interface IArtifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • getArtifactModel

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

        public java.lang.String getName()
                                 throws VilException
        Returns the simple name of this artifact.
        Specified by:
        getName in interface IArtifact
        Returns:
        the simple name
        Throws:
        VilException - in case that the operation cannot continue
      • getPlainName

        public java.lang.String getPlainName()
                                      throws VilException
        Returns the plain name without (possible) extension.
        Returns:
        the plain name of the artifact
        Throws:
        VilException - in case that errors occur
      • getPathSegments

        public java.lang.String getPathSegments()
        Returns the path segments of this path (excluding the names).
        Returns:
        the path segments
      • getPath

        public Path getPath()
        Description copied from interface: IFileSystemArtifact
        Returns the path artifact representing the path to this file system artifact. The absolute and simple name can be obtained from the path. Note that IArtifact.getName() will return the simple name of this artifact.
        Specified by:
        getPath in interface IFileSystemArtifact
        Returns:
        the path
      • rename

        public void rename​(java.lang.String name)
                    throws VilException
        Description copied from interface: IArtifact
        Renames this artifact.
        Specified by:
        rename in interface IArtifact
        Parameters:
        name - the new name of this artifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • accept

        public void accept​(IArtifactVisitor visitor)
        Description copied from interface: IArtifact
        Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
        Specified by:
        accept in interface IArtifact
        Parameters:
        visitor - the visitor used for visiting this artifact
      • copy

        public Set<IFileSystemArtifact> copy​(IFileSystemArtifact target)
                                      throws VilException
        Description copied from interface: IFileSystemArtifact
        Copy this artifact.
        Specified by:
        copy in interface IFileSystemArtifact
        Parameters:
        target - the target artifact. In case of a file, the target is supposed to be overridden by a copy of this artifact. In case of a directory, a copy of this artifact shall after this operation be part of the directory.
        Returns:
        this (for chained operations)
        Throws:
        VilException - in case of serious problems
      • substituteExtension

        public Path substituteExtension​(java.lang.String extension)
                                 throws VilException
        Substitutes the extension.
        Parameters:
        extension - the new extension
        Returns:
        the path
        Throws:
        VilException - in case of problems
      • convert

        public static FileArtifact convert​(java.lang.String val)
                                    throws VilException
        Conversion operation.
        Parameters:
        val - the value to be converted
        Returns:
        the converted value
        Throws:
        VilException - in case that creating the artifact fails
      • convert

        public static FileArtifact convert​(IFileSystemArtifact val)
        Conversion operation.
        Parameters:
        val - the value to be converted
        Returns:
        the converted value
      • convert

        public static Path convert​(FileArtifact val)
                            throws VilException
        Conversion operation.
        Parameters:
        val - the value to be converted
        Returns:
        the converted value
        Throws:
        VilException - in case of problems
      • convert

        public static FileArtifact convert​(Path path)
                                    throws VilException
        Conversion operation.
        Parameters:
        path - the path to be converted
        Returns:
        the converted value
        Throws:
        VilException - in case that creating the artifact fails
      • lastModification

        public long lastModification()
        Description copied from interface: IArtifact
        Returns the last modification timestamp of this artifact.
        Specified by:
        lastModification in interface IArtifact
        Returns:
        the last modification timestamp, 0 if unknown
      • exists

        public boolean exists()
        Description copied from interface: IArtifact
        Returns whether this artifact is exists.
        Specified by:
        exists in interface IArtifact
        Returns:
        true if this artifact exists, false else
      • 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
      • store

        public void store()
                   throws VilException
        Description copied from interface: IArtifact
        Stores this artifact in case of changes.
        Specified by:
        store in interface IArtifact
        Throws:
        VilException - in case of problems storing this artifact
      • determineActualValue

        public java.lang.Object determineActualValue​(java.lang.Object object)
        Description copied from interface: IActualValueProvider
        Determines a more actual value for object in the context of using it for this type. Default types implementing this interface shall not use their attributes as this method will be called via a template object.
        Specified by:
        determineActualValue in interface IActualValueProvider
        Parameters:
        object - the initial object (may be null)
        Returns:
        the actual object (may be object if no actual value is available, may be null if object was null)
      • setExecutable

        public void setExecutable​(boolean ownerOnly)
                           throws VilException
        Description copied from interface: IFileSystemArtifact
        Enables the (operation system specific) execution flag for this artifact.
        Specified by:
        setExecutable in interface IFileSystemArtifact
        Parameters:
        ownerOnly - whether all users or just the owner shall be allowed to exectue this artifact
        Throws:
        VilException - if the executable flag cannot be set.