Class FolderArtifact
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.artifactModel.SimpleArtifact
-
- net.ssehub.easy.instantiation.core.model.artifactModel.FolderArtifact
-
- All Implemented Interfaces:
IArtifact,IArtifactChangedListener,IFileSystemArtifact,IActualValueProvider,IStringValueProvider,IVilType
public class FolderArtifact extends SimpleArtifact implements IFileSystemArtifact, IArtifactChangedListener, IActualValueProvider
Represents a file system folder.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description static FolderArtifactDEFAULTprivate booleanisTemporaryprivate Pathpath
-
Constructor Summary
Constructors Modifier Constructor Description (package private)FolderArtifact()Default constructor foractual value provider template.protectedFolderArtifact(java.io.File file, ArtifactModel model)Creates a path artifact from the givenfile.protectedFolderArtifact(Path path)Creates a path artifact from the givenpath.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IArtifactVisitor visitor)Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.voidartifactChanged(java.lang.Object cause)Is called when the artifact was changed, e.g., to trigger a reanalysis of substructures.static FolderArtifactconvert(java.lang.String val)Conversion operation.static Pathconvert(FolderArtifact val)Conversion operation.static FolderArtifactconvert(Path path)Converts a path into a folder.Set<IFileSystemArtifact>copy(IFileSystemArtifact target)Copy this artifact.static FolderArtifactcreate()Creates a temporary file artifact.voiddelete()Deletes this artifact.java.lang.ObjectdetermineActualValue(java.lang.Object object)Determines a more actual value forobjectin the context of using it for this type.booleanexists()Returns whether this artifact is exists.BinarygetBinary()Returns the binary representation of the contents of this artifact for manipulation.java.lang.StringgetName()Returns the name of this artifact.PathgetPath()Returns the path artifact representing the path to this file system artifact.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.TextgetText()Returns the textual representation of the contents of this artifact for manipulation.booleanisTemporary()Returns whether this artifact is (considered to be) a temporary artifact.longlastModification()Returns the last modification timestamp of this artifact.Set<IFileSystemArtifact>move(IFileSystemArtifact target)Move this artifact.voidrename(java.lang.String name)Renames this artifact.Set<FileArtifact>selectAll()Returns the contained file system artifacts, i.e., folder and file artifacts.voidsetExecutable(boolean ownerOnly)Enables the (operation system specific) execution flag for this artifact.voidstore()Stores this artifact in case of changes.voidupdate()Called if the underlying real artifact may have been updated, e.g., by overriding it by another file.
-
-
-
Field Detail
-
DEFAULT
public static final FolderArtifact DEFAULT
-
path
private Path path
-
isTemporary
private boolean isTemporary
-
-
Constructor Detail
-
FolderArtifact
FolderArtifact()
Default constructor foractual value provider template.
-
FolderArtifact
protected FolderArtifact(Path path)
Creates a path artifact from the givenpath. A path may be a (regular) pattern!- Parameters:
path- the path representing the folder
-
FolderArtifact
protected FolderArtifact(java.io.File file, ArtifactModel model)Creates a path artifact from the givenfile. A path may be a (regular) pattern!- Parameters:
file- the file representing the pathmodel- the artifact model to create this folder artifact within
-
-
Method Detail
-
create
public static FolderArtifact create() throws VilException
Creates a temporary file artifact.- Returns:
- the created file artifact
- Throws:
VilException- in case that the creation fails
-
delete
public void delete() throws VilExceptionDescription copied from interface:IArtifactDeletes this artifact.- Specified by:
deletein interfaceIArtifact- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
getName
public java.lang.String getName() throws VilExceptionDescription copied from interface:IArtifactReturns the name of this artifact.- Specified by:
getNamein interfaceIArtifact- Returns:
- the name of this artifact
- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
rename
public void rename(java.lang.String name) throws VilExceptionDescription copied from interface:IArtifactRenames this artifact.- Specified by:
renamein interfaceIArtifact- Parameters:
name- the new name of this artifact- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
getText
public Text getText() throws VilException
Description copied from interface:IArtifactReturns the textual representation of the contents of this artifact for manipulation. In case of binary artifacts, the returned object may be empty.- Specified by:
getTextin interfaceIArtifact- Returns:
- the textual representation of the contents
- Throws:
VilException- in case of obtaining the representation causes serious problems
-
getBinary
public Binary getBinary() throws VilException
Description copied from interface:IArtifactReturns the binary representation of the contents of this artifact for manipulation.- Specified by:
getBinaryin interfaceIArtifact- Returns:
- the binary representation of the contents
- Throws:
VilException- in case of obtaining the representation causes serious problems
-
accept
public void accept(IArtifactVisitor visitor)
Description copied from interface:IArtifactVisits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
-
getPath
public Path getPath()
Description copied from interface:IFileSystemArtifactReturns the path artifact representing the path to this file system artifact. The absolute and simple name can be obtained from the path. Note thatIArtifact.getName()will return the simple name of this artifact.- Specified by:
getPathin interfaceIFileSystemArtifact- Returns:
- the path
-
move
public Set<IFileSystemArtifact> move(IFileSystemArtifact target) throws VilException
Description copied from interface:IFileSystemArtifactMove this artifact.- Specified by:
movein interfaceIFileSystemArtifact- Parameters:
target- the target artifact. In case of a file, the target is supposed to be overridden. In case of a directory, this artifact shall after this operation be part of the directory.- Returns:
- this (for chained operations)
- Throws:
VilException- in case of serious problems
-
copy
public Set<IFileSystemArtifact> copy(IFileSystemArtifact target) throws VilException
Description copied from interface:IFileSystemArtifactCopy this artifact.- Specified by:
copyin interfaceIFileSystemArtifact- 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
-
selectAll
public Set<FileArtifact> selectAll() throws VilException
Returns the contained file system artifacts, i.e., folder and file artifacts.- Returns:
- the contained artifacts as collection
- Throws:
VilException- in case that obtaining the artifacts fails
-
artifactChanged
public void artifactChanged(java.lang.Object cause) throws VilExceptionDescription copied from interface:IArtifactChangedListenerIs called when the artifact was changed, e.g., to trigger a reanalysis of substructures.- Specified by:
artifactChangedin interfaceIArtifactChangedListener- Parameters:
cause- the cause for the change, e.g., an artifact representation- Throws:
VilException- in case that the required operations fail for some reason
-
convert
public static FolderArtifact convert(java.lang.String val)
Conversion operation.- Parameters:
val- the value to be converted- Returns:
- the converted value
-
convert
public static Path convert(FolderArtifact 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 FolderArtifact convert(Path path) throws VilException
Converts a path into a folder.- Parameters:
path- the path to be converted- Returns:
- the resulting folder
- Throws:
VilException- in case of problems
-
lastModification
public long lastModification()
Description copied from interface:IArtifactReturns the last modification timestamp of this artifact.- Specified by:
lastModificationin interfaceIArtifact- Returns:
- the last modification timestamp, 0 if unknown
-
exists
public boolean exists()
Description copied from interface:IArtifactReturns whether this artifact is exists.
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- 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 VilExceptionDescription copied from interface:IArtifactStores this artifact in case of changes.- Specified by:
storein interfaceIArtifact- Throws:
VilException- in case of problems storing this artifact
-
isTemporary
public boolean isTemporary()
Returns whether this artifact is (considered to be) a temporary artifact.- Specified by:
isTemporaryin interfaceIFileSystemArtifact- Returns:
trueif it is temporary,falseelse
-
update
public void update() throws VilExceptionDescription copied from interface:IArtifactCalled if the underlying real artifact may have been updated, e.g., by overriding it by another file.- Specified by:
updatein interfaceIArtifact- Throws:
VilException- in case that updating fails
-
determineActualValue
public java.lang.Object determineActualValue(java.lang.Object object)
Description copied from interface:IActualValueProviderDetermines a more actual value forobjectin 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:
determineActualValuein interfaceIActualValueProvider- Parameters:
object- the initial object (may be null)- Returns:
- the actual object (may be
objectif no actual value is available, may be null ifobjectwas null)
-
setExecutable
public void setExecutable(boolean ownerOnly) throws VilExceptionDescription copied from interface:IFileSystemArtifactEnables the (operation system specific) execution flag for this artifact.- Specified by:
setExecutablein interfaceIFileSystemArtifact- 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.
-
-