org.pentaho.di.repository
Class RepositoryDirectory

java.lang.Object
  extended by org.pentaho.di.repository.RepositoryDirectory

public class RepositoryDirectory
extends Object

This class defines the location of a transformation, job or schema in the repository. That means that it's just an extra parameter for recognising a transformation, job or schema. It allows for subdirectories by linking back to itself.

Since:
09-nov-2004
Author:
Matt

Field Summary
static String DIRECTORY_SEPARATOR
           
 
Constructor Summary
RepositoryDirectory()
          Create an empty repository directory.
RepositoryDirectory(Repository rep)
          Load the complete directory tree from the repository.
RepositoryDirectory(RepositoryDirectory parent, String directoryname)
          Create a new subdirectory in a certain other directory.
 
Method Summary
 void addSubdirectory(RepositoryDirectory subdir)
          Add a subdirectory to this directory.
 boolean addToRep(Repository rep)
           
 void clear()
           
 RepositoryDirectory createDirectory(Repository rep, String directoryPath)
          Create a new directory, possibly by creating several subdirecties of / at the same time.
 void delFromRep(Repository rep)
           
 RepositoryDirectory findDirectory(long id_directory)
          Find the sub-directory with a certain ID
 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 strings
 RepositoryDirectory findRoot()
          Find the root of the directory tree starting from this directory.
 long[] getDirectoryIDs()
          Get all the directory-id in this directory and the subdirectories.
 String getDirectoryName()
          Get the name of this directory...
 long getID()
          Get the database ID in the repository for this object.
 int getNrSubdirectories()
          Counts the number of subdirectories in this directory.
 RepositoryDirectory 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)
           
 RepositoryDirectory 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 loadRep(Repository rep, long id_directory)
           
 boolean loadXML(Node repdirnode)
          Load the directory & subdirectories from XML
 boolean renameInRep(Repository rep)
           
 void setDirectoryName(String directoryname)
          Set the directory name (rename)
 void setID(long id)
          Set the database ID for this object in the repository.
 void setParent(RepositoryDirectory parent)
          Change the parent of this directory.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIRECTORY_SEPARATOR

public static final String DIRECTORY_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

RepositoryDirectory

public RepositoryDirectory(RepositoryDirectory parent,
                           String directoryname)
Create a new subdirectory in a certain other directory.

Parameters:
parent - The directory to create the subdirectory in
directoryname - 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.


RepositoryDirectory

public RepositoryDirectory(Repository rep)
                    throws org.pentaho.di.core.exception.KettleException
Load the complete directory tree from the repository.

Parameters:
rep - Repository
Throws:
org.pentaho.di.core.exception.KettleException
Method Detail

clear

public void clear()

getID

public long getID()
Get the database ID in the repository for this object.

Returns:
the database ID in the repository for this object.

setID

public void setID(long id)
Set the database ID for this object in the repository.

Parameters:
id - the database ID for this object in the repository.

setParent

public void setParent(RepositoryDirectory parent)
Change the parent of this directory. (move directory)

Parameters:
parent - The new parent of this directory.

getParent

public RepositoryDirectory getParent()
get the parent directory for this directory.

Returns:
The parent directory of null if this is the root directory.

setDirectoryName

public void setDirectoryName(String directoryname)
Set the directory name (rename)

Parameters:
directoryname - The new directory name

getDirectoryName

public String getDirectoryName()
Get the name of this directory...

Returns:
the name of this directory

isRoot

public boolean isRoot()
Check whether or not this is the root of the directory trees. (default)

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).

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.

Returns:
The complete path to this directory.

addSubdirectory

public void addSubdirectory(RepositoryDirectory subdir)
Add a subdirectory to this directory.

Parameters:
subdir - The subdirectory to add.

getNrSubdirectories

public int getNrSubdirectories()
Counts the number of subdirectories in this directory.

Returns:
The number of subdirectories

getSubdirectory

public RepositoryDirectory getSubdirectory(int i)
Get a subdirectory on a certain position.

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

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.

Parameters:
path - The path to the directory
Returns:
The directory if one was found, null if nothing was found.

findDirectory

public RepositoryDirectory findDirectory(long id_directory)
Find the sub-directory with a certain ID

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.

loadRep

public boolean loadRep(Repository rep,
                       long id_directory)

addToRep

public boolean addToRep(Repository rep)

delFromRep

public void delFromRep(Repository rep)
                throws org.pentaho.di.core.exception.KettleException
Throws:
org.pentaho.di.core.exception.KettleException

renameInRep

public boolean renameInRep(Repository rep)

getDirectoryIDs

public long[] getDirectoryIDs()
Get all the directory-id in this directory and the subdirectories.

Returns:
an array of all the directory id's (this directory & subdirectories)

findRoot

public RepositoryDirectory findRoot()
Find the root of the directory tree starting from this directory.

Returns:
the root of the directory tree

createDirectory

public RepositoryDirectory createDirectory(Repository rep,
                                           String directoryPath)
                                    throws org.pentaho.di.core.exception.KettleDatabaseException
Create a new directory, possibly by creating several subdirecties of / at the same time.

Parameters:
directoryPath - The path to the new Repository Directory, to be created.
Returns:
The created subdirectory
Throws:
org.pentaho.di.core.exception.KettleDatabaseException

toString

public String toString()
Overrides:
toString in class Object

getPathObjectCombination

public String getPathObjectCombination(String transName)