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 String
DIRECTORY_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 void
addSubdirectory(RepositoryDirectoryInterface subdir)
Add a subdirectory to this directory.void
clear()
RepositoryDirectory
findChild(String name)
RepositoryDirectory
findDirectory(String path)
Find a directory using the path to the directory with file.separator between the dir-names.RepositoryDirectory
findDirectory(String[] path)
Find the directory by following the path of stringsRepositoryDirectory
findDirectory(ObjectId id_directory)
Find the sub-directory with a certain IDRepositoryDirectoryInterface
findRoot()
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.String
getName()
Get the name of this directory...int
getNrSubdirectories()
Counts the number of subdirectories in this directory.ObjectId
getObjectId()
Get the database ID in the repository for this object.RepositoryDirectoryInterface
getParent()
get the parent directory for this directory.String
getPath()
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.String
getPathObjectCombination(String transName)
List<RepositoryElementMetaInterface>
getRepositoryObjects()
Returns a list of child filesRepositoryDirectory
getSubdirectory(int i)
Get a subdirectory on a certain position.String
getXML()
Return the description of this directory & the subdirectories in XML.String
getXML(int level)
boolean
isRoot()
Check whether or not this is the root of the directory trees.boolean
isVisible()
If true, this directory should be shown in UIs.boolean
loadXML(Node repdirnode)
Load the directory & subdirectories from XMLvoid
setChildren(List<RepositoryDirectoryInterface> children)
sets the list of child directoriesvoid
setName(String directoryname)
Set the directory name (rename)void
setObjectId(ObjectId id)
Set the database ID for this object in the repository.void
setParent(RepositoryDirectoryInterface parent)
Change the parent of this directory.void
setRepositoryObjects(List<RepositoryElementMetaInterface> repositoryObjects)
sets the list of child filesvoid
setVisible(boolean visible)
String
toString()
-
-
-
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:RepositoryDirectoryInterface
Returns a list of child directories- Specified by:
getChildren
in interfaceRepositoryDirectoryInterface
- Returns:
- list of child directories
-
setChildren
public void setChildren(List<RepositoryDirectoryInterface> children)
Description copied from interface:RepositoryDirectoryInterface
sets the list of child directories- Specified by:
setChildren
in interfaceRepositoryDirectoryInterface
- Parameters:
children
- list of child directories
-
getRepositoryObjects
public List<RepositoryElementMetaInterface> getRepositoryObjects()
Description copied from interface:RepositoryDirectoryInterface
Returns a list of child files- Specified by:
getRepositoryObjects
in interfaceRepositoryDirectoryInterface
- Returns:
- list of child files
-
setRepositoryObjects
public void setRepositoryObjects(List<RepositoryElementMetaInterface> repositoryObjects)
Description copied from interface:RepositoryDirectoryInterface
sets the list of child files- Specified by:
setRepositoryObjects
in interfaceRepositoryDirectoryInterface
- Parameters:
repositoryObjects
- list of child files
-
clear
public void clear()
- Specified by:
clear
in interfaceRepositoryDirectoryInterface
-
getObjectId
public ObjectId getObjectId()
Get the database ID in the repository for this object.- Specified by:
getObjectId
in 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:
setObjectId
in 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:
setParent
in interfaceRepositoryDirectoryInterface
- Parameters:
parent
- The new parent of this directory.
-
getParent
public RepositoryDirectoryInterface getParent()
get the parent directory for this directory.- Specified by:
getParent
in 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:
setName
in interfaceRepositoryDirectoryInterface
- Parameters:
directoryname
- The new directory name
-
getName
public String getName()
Get the name of this directory...- Specified by:
getName
in 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:
isRoot
in 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:
getPath
in 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:
getPathArray
in interfaceRepositoryDirectoryInterface
- Returns:
- The complete path to this directory.
-
addSubdirectory
public void addSubdirectory(RepositoryDirectoryInterface subdir)
Add a subdirectory to this directory.- Specified by:
addSubdirectory
in interfaceRepositoryDirectoryInterface
- Parameters:
subdir
- The subdirectory to add.
-
getNrSubdirectories
public int getNrSubdirectories()
Counts the number of subdirectories in this directory.- Specified by:
getNrSubdirectories
in interfaceRepositoryDirectoryInterface
- Returns:
- The number of subdirectories
-
getSubdirectory
public RepositoryDirectory getSubdirectory(int i)
Get a subdirectory on a certain position.- Specified by:
getSubdirectory
in 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:
findDirectory
in 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:
findDirectory
in 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:
findChild
in interfaceRepositoryDirectoryInterface
-
findDirectory
public RepositoryDirectory findDirectory(ObjectId id_directory)
Find the sub-directory with a certain ID- Specified by:
findDirectory
in 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:
getDirectoryIDs
in 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:
findRoot
in interfaceRepositoryDirectoryInterface
- Returns:
- the root of the directory tree
-
getPathObjectCombination
public String getPathObjectCombination(String transName)
- Specified by:
getPathObjectCombination
in interfaceRepositoryDirectoryInterface
-
isVisible
public boolean isVisible()
Description copied from interface:RepositoryDirectoryInterface
If true, this directory should be shown in UIs. Not necessarily persisted. Each repository implementation decides whether to mark each directory as visible.- Specified by:
isVisible
in interfaceRepositoryDirectoryInterface
-
setVisible
public void setVisible(boolean visible)
-
-