Package org.pentaho.di.repository
Class RepositoryDirectory
- java.lang.Object
-
- org.pentaho.di.repository.RepositoryDirectory
-
- All Implemented Interfaces:
RepositoryDirectoryInterface,RepositoryObjectInterface
public class RepositoryDirectory extends Object implements RepositoryDirectoryInterface
This class defines the location of a transformation, job or schema in the repository. That means that it's just an extra parameter for recognizing a transformation, job or schema. It allows for sub-directories by linking back to itself. TODO: This class is referenced in a large amount of Interfaces. We should convert it into an interface.- Since:
- 09-nov-2004
- Author:
- Matt
-
-
Field Summary
Fields Modifier and Type Field Description static StringDIRECTORY_SEPARATOR
-
Constructor Summary
Constructors Constructor Description RepositoryDirectory()Create an empty repository directory.RepositoryDirectory(RepositoryDirectoryInterface parent, String directoryname)Create a new sub-directory in a certain other directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSubdirectory(RepositoryDirectoryInterface subdir)Add a subdirectory to this directory.voidclear()RepositoryDirectoryfindChild(String name)RepositoryDirectoryfindDirectory(String path)Find a directory using the path to the directory with file.separator between the dir-names.RepositoryDirectoryfindDirectory(String[] path)Find the directory by following the path of stringsRepositoryDirectoryfindDirectory(ObjectId id_directory)Find the sub-directory with a certain IDRepositoryDirectoryInterfacefindRoot()Find the root of the directory tree starting from this directory.List<RepositoryDirectoryInterface>getChildren()Returns a list of child directoriesObjectId[]getDirectoryIDs()Get all the directory-id in this directory and the subdirectories.StringgetName()Get the name of this directory...intgetNrSubdirectories()Counts the number of subdirectories in this directory.ObjectIdgetObjectId()Get the database ID in the repository for this object.RepositoryDirectoryInterfacegetParent()get the parent directory for this directory.StringgetPath()Describe the complete path to ( and including) this directory, separated by the RepositoryDirectory.DIRECTORY_SEPARATOR property (slash).String[]getPathArray()Describe the complete path to ( and including) this directory, as an array of strings.StringgetPathObjectCombination(String transName)List<RepositoryElementMetaInterface>getRepositoryObjects()Returns a list of child filesRepositoryDirectorygetSubdirectory(int i)Get a subdirectory on a certain position.StringgetXML()Return the description of this directory & the subdirectories in XML.StringgetXML(int level)booleanisRoot()Check whether or not this is the root of the directory trees.booleanisVisible()If true, this directory should be shown in UIs.booleanloadXML(Node repdirnode)Load the directory & subdirectories from XMLvoidsetChildren(List<RepositoryDirectoryInterface> children)sets the list of child directoriesvoidsetName(String directoryname)Set the directory name (rename)voidsetObjectId(ObjectId id)Set the database ID for this object in the repository.voidsetParent(RepositoryDirectoryInterface parent)Change the parent of this directory.voidsetRepositoryObjects(List<RepositoryElementMetaInterface> repositoryObjects)sets the list of child filesvoidsetVisible(boolean visible)StringtoString()
-
-
-
Field Detail
-
DIRECTORY_SEPARATOR
public static final String DIRECTORY_SEPARATOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RepositoryDirectory
public RepositoryDirectory(RepositoryDirectoryInterface parent, String directoryname)
Create a new sub-directory in a certain other directory.- Parameters:
parent- The directory to create the sub-directory indirectoryname- The name of the new directory.
-
RepositoryDirectory
public RepositoryDirectory()
Create an empty repository directory. With the name and parent set to empty, this is the root directory.
-
-
Method Detail
-
getChildren
public List<RepositoryDirectoryInterface> getChildren()
Description copied from interface:RepositoryDirectoryInterfaceReturns a list of child directories- Specified by:
getChildrenin interfaceRepositoryDirectoryInterface- Returns:
- list of child directories
-
setChildren
public void setChildren(List<RepositoryDirectoryInterface> children)
Description copied from interface:RepositoryDirectoryInterfacesets the list of child directories- Specified by:
setChildrenin interfaceRepositoryDirectoryInterface- Parameters:
children- list of child directories
-
getRepositoryObjects
public List<RepositoryElementMetaInterface> getRepositoryObjects()
Description copied from interface:RepositoryDirectoryInterfaceReturns a list of child files- Specified by:
getRepositoryObjectsin interfaceRepositoryDirectoryInterface- Returns:
- list of child files
-
setRepositoryObjects
public void setRepositoryObjects(List<RepositoryElementMetaInterface> repositoryObjects)
Description copied from interface:RepositoryDirectoryInterfacesets the list of child files- Specified by:
setRepositoryObjectsin interfaceRepositoryDirectoryInterface- Parameters:
repositoryObjects- list of child files
-
clear
public void clear()
- Specified by:
clearin interfaceRepositoryDirectoryInterface
-
getObjectId
public ObjectId getObjectId()
Get the database ID in the repository for this object.- Specified by:
getObjectIdin interfaceRepositoryObjectInterface- Returns:
- the database ID in the repository for this object.
-
setObjectId
public void setObjectId(ObjectId id)
Set the database ID for this object in the repository.- Specified by:
setObjectIdin interfaceRepositoryDirectoryInterface- Parameters:
id- the database ID for this object in the repository.
-
setParent
public void setParent(RepositoryDirectoryInterface parent)
Change the parent of this directory. (move directory)- Specified by:
setParentin interfaceRepositoryDirectoryInterface- Parameters:
parent- The new parent of this directory.
-
getParent
public RepositoryDirectoryInterface getParent()
get the parent directory for this directory.- Specified by:
getParentin interfaceRepositoryDirectoryInterface- Returns:
- The parent directory of null if this is the root directory.
-
setName
public void setName(String directoryname)
Set the directory name (rename)- Specified by:
setNamein interfaceRepositoryDirectoryInterface- Parameters:
directoryname- The new directory name
-
getName
public String getName()
Get the name of this directory...- Specified by:
getNamein interfaceRepositoryObjectInterface- Returns:
- the name of this directory
-
isRoot
public boolean isRoot()
Check whether or not this is the root of the directory trees. (default)- Specified by:
isRootin interfaceRepositoryDirectoryInterface- Returns:
- true if this is the root directory node. False if it is not.
-
getPath
public String getPath()
Describe the complete path to ( and including) this directory, separated by the RepositoryDirectory.DIRECTORY_SEPARATOR property (slash).- Specified by:
getPathin interfaceRepositoryDirectoryInterface- Returns:
- The complete path to this directory.
-
getPathArray
public String[] getPathArray()
Describe the complete path to ( and including) this directory, as an array of strings.- Specified by:
getPathArrayin interfaceRepositoryDirectoryInterface- Returns:
- The complete path to this directory.
-
addSubdirectory
public void addSubdirectory(RepositoryDirectoryInterface subdir)
Add a subdirectory to this directory.- Specified by:
addSubdirectoryin interfaceRepositoryDirectoryInterface- Parameters:
subdir- The subdirectory to add.
-
getNrSubdirectories
public int getNrSubdirectories()
Counts the number of subdirectories in this directory.- Specified by:
getNrSubdirectoriesin interfaceRepositoryDirectoryInterface- Returns:
- The number of subdirectories
-
getSubdirectory
public RepositoryDirectory getSubdirectory(int i)
Get a subdirectory on a certain position.- Specified by:
getSubdirectoryin interfaceRepositoryDirectoryInterface- Parameters:
i- The subdirectory position- Returns:
- The subdirectory with on a certain position
-
findDirectory
public RepositoryDirectory findDirectory(String[] path)
Find the directory by following the path of strings- Specified by:
findDirectoryin interfaceRepositoryDirectoryInterface- Parameters:
path- The path to the directory we're looking for.- Returns:
- The directory if one can be found, null if no directory was found.
-
findDirectory
public RepositoryDirectory findDirectory(String path)
Find a directory using the path to the directory with file.separator between the dir-names.- Specified by:
findDirectoryin interfaceRepositoryDirectoryInterface- Parameters:
path- The path to the directory- Returns:
- The directory if one was found, null if nothing was found.
-
findChild
public RepositoryDirectory findChild(String name)
- Specified by:
findChildin interfaceRepositoryDirectoryInterface
-
findDirectory
public RepositoryDirectory findDirectory(ObjectId id_directory)
Find the sub-directory with a certain ID- Specified by:
findDirectoryin interfaceRepositoryDirectoryInterface- Parameters:
id_directory- the directory ID to look for.- Returns:
- The RepositoryDirectory if the ID was found, null if nothing could be found.
-
getXML
public String getXML()
Return the description of this directory & the subdirectories in XML.- Returns:
- The XML describing this directory.
-
getXML
public String getXML(int level)
-
loadXML
public boolean loadXML(Node repdirnode)
Load the directory & subdirectories from XML- Parameters:
repdirnode- The node in which the Repository directory information resides.- Returns:
- True if all went well, false if an error occured.
-
getDirectoryIDs
public ObjectId[] getDirectoryIDs()
Get all the directory-id in this directory and the subdirectories.- Specified by:
getDirectoryIDsin interfaceRepositoryDirectoryInterface- Returns:
- an array of all the directory id's (this directory & subdirectories)
-
findRoot
public RepositoryDirectoryInterface findRoot()
Find the root of the directory tree starting from this directory.- Specified by:
findRootin interfaceRepositoryDirectoryInterface- Returns:
- the root of the directory tree
-
getPathObjectCombination
public String getPathObjectCombination(String transName)
- Specified by:
getPathObjectCombinationin interfaceRepositoryDirectoryInterface
-
isVisible
public boolean isVisible()
Description copied from interface:RepositoryDirectoryInterfaceIf true, this directory should be shown in UIs. Not necessarily persisted. Each repository implementation decides whether to mark each directory as visible.- Specified by:
isVisiblein interfaceRepositoryDirectoryInterface
-
setVisible
public void setVisible(boolean visible)
-
-