org.pentaho.di.partition
Class PartitionSchema

java.lang.Object
  extended by org.pentaho.di.core.changed.ChangedFlag
      extended by org.pentaho.di.partition.PartitionSchema
All Implemented Interfaces:
Cloneable, ChangedFlagInterface, XMLInterface, RepositoryElementInterface, RepositoryObjectInterface, ResourceHolderInterface, SharedObjectInterface

public class PartitionSchema
extends ChangedFlag
implements Cloneable, SharedObjectInterface, ResourceHolderInterface, RepositoryElementInterface, XMLInterface

A partition schema allow you to partition a step according into a number of partitions that run independendly. It allows us to "map"

Author:
Matt

Field Summary
static RepositoryObjectType REPOSITORY_ELEMENT_TYPE
           
static String XML_TAG
           
 
Constructor Summary
PartitionSchema()
           
PartitionSchema(Node partitionSchemaNode)
           
PartitionSchema(String name, List<String> partitionIDs)
           
 
Method Summary
 Object clone()
           
 boolean equals(Object obj)
           
 void expandPartitionsDynamically(int nrSlaves, VariableSpace space)
           
 Date getChangedDate()
           
 String getDescription()
          Gets the description of the repository object.
 String getHolderType()
          Gets the high-level type of resource holder.
 String getName()
          Gets the name of the repository object.
 String getNumberOfPartitionsPerSlave()
           
 ObjectId getObjectId()
          Get the database ID in the repository for this object.
 ObjectRevision getObjectRevision()
          Gets the object revision.
 List<String> getPartitionIDs()
           
 RepositoryDirectoryInterface getRepositoryDirectory()
          Not supported for Partition schema, return the root.
 RepositoryObjectType getRepositoryElementType()
          Gets the repository element type.
 String getTypeId()
           
 String getXML()
          Describes the Object implementing this interface as XML
 int hashCode()
           
 boolean isDynamicallyDefined()
           
 boolean isShared()
           
 void replaceMeta(PartitionSchema partitionSchema)
           
 void retainPartitionsForSlaveServer(int slaveCount, int slaveNumber)
          Slaves don't need ALL the partitions, they just need a few.
So we should only retain those partitions that are of interest to the slave server.
Divide the number of partitions (6) through the number of slaves (2)
That gives you 0, 1, 2, 3, 4, 5
Slave 0 : 0, 2, 4
Slave 1 : 1, 3, 5
--> slaveNumber == partitionNr % slaveCount
 void setChangedDate(Date changedDate)
           
 void setDescription(String description)
          Sets the description of the repository object.
 void setDynamicallyDefined(boolean dynamicallyDefined)
           
 void setName(String name)
          Sets the name of the repository object.
 void setNumberOfPartitionsPerSlave(String numberOfPartitionsPerSlave)
           
 void setObjectId(ObjectId id)
          Set the database ID for this object in the repository.
 void setObjectRevision(ObjectRevision objectRevision)
          Sets the object revision.
 void setPartitionIDs(List<String> partitionIDs)
           
 void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
           
 void setShared(boolean shared)
           
 String toString()
           
 
Methods inherited from class org.pentaho.di.core.changed.ChangedFlag
addObserver, clearChanged, deleteObserver, hasChanged, notifyObservers, setChanged, setChanged
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_TAG

public static final String XML_TAG
See Also:
Constant Field Values

REPOSITORY_ELEMENT_TYPE

public static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE
Constructor Detail

PartitionSchema

public PartitionSchema()

PartitionSchema

public PartitionSchema(String name,
                       List<String> partitionIDs)
Parameters:
name -
partitionIDs -

PartitionSchema

public PartitionSchema(Node partitionSchemaNode)
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

replaceMeta

public void replaceMeta(PartitionSchema partitionSchema)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getName

public String getName()
Description copied from interface: RepositoryElementInterface
Gets the name of the repository object.

Specified by:
getName in interface RepositoryElementInterface
Specified by:
getName in interface RepositoryObjectInterface
Specified by:
getName in interface ResourceHolderInterface
Specified by:
getName in interface SharedObjectInterface
Returns:
the name

setName

public void setName(String name)
Description copied from interface: RepositoryElementInterface
Sets the name of the repository object.

Specified by:
setName in interface RepositoryElementInterface
Parameters:
name - the name to set

getPartitionIDs

public List<String> getPartitionIDs()
Returns:
the partitionIDs

setPartitionIDs

public void setPartitionIDs(List<String> partitionIDs)
Parameters:
partitionIDs - the partitionIDs to set

getXML

public String getXML()
Description copied from interface: XMLInterface
Describes the Object implementing this interface as XML

Specified by:
getXML in interface XMLInterface
Specified by:
getXML in interface SharedObjectInterface
Returns:
the XML string for this object

isShared

public boolean isShared()
Specified by:
isShared in interface SharedObjectInterface
Returns:
the shared

setShared

public void setShared(boolean shared)
Specified by:
setShared in interface SharedObjectInterface
Parameters:
shared - the shared to set

getObjectId

public ObjectId getObjectId()
Description copied from interface: RepositoryElementInterface
Get the database ID in the repository for this object.

Specified by:
getObjectId in interface RepositoryElementInterface
Specified by:
getObjectId in interface RepositoryObjectInterface
Specified by:
getObjectId in interface ResourceHolderInterface
Returns:
the id

getDescription

public String getDescription()
Description copied from interface: RepositoryElementInterface
Gets the description of the repository object.

Specified by:
getDescription in interface RepositoryElementInterface
Specified by:
getDescription in interface ResourceHolderInterface
Returns:
The description of the holder of the resource

getHolderType

public String getHolderType()
Description copied from interface: ResourceHolderInterface
Gets the high-level type of resource holder.

Specified by:
getHolderType in interface ResourceHolderInterface
Returns:
JOBENTRY, STEP, etc.

getTypeId

public String getTypeId()
Specified by:
getTypeId in interface ResourceHolderInterface
Returns:
The Type ID of the resource holder. The Type ID is the system-defined type identifier (like TRANS or SORT).

isDynamicallyDefined

public boolean isDynamicallyDefined()
Returns:
the dynamicallyDefined

setDynamicallyDefined

public void setDynamicallyDefined(boolean dynamicallyDefined)
Parameters:
dynamicallyDefined - the dynamicallyDefined to set

getNumberOfPartitionsPerSlave

public String getNumberOfPartitionsPerSlave()
Returns:
the numberOfStepCopiesPerSlave

setNumberOfPartitionsPerSlave

public void setNumberOfPartitionsPerSlave(String numberOfPartitionsPerSlave)
Parameters:
numberOfPartitionsPerSlave - the number of partitions per slave to set...

expandPartitionsDynamically

public void expandPartitionsDynamically(int nrSlaves,
                                        VariableSpace space)

retainPartitionsForSlaveServer

public void retainPartitionsForSlaveServer(int slaveCount,
                                           int slaveNumber)
Slaves don't need ALL the partitions, they just need a few.
So we should only retain those partitions that are of interest to the slave server.
Divide the number of partitions (6) through the number of slaves (2)
That gives you 0, 1, 2, 3, 4, 5
Slave 0 : 0, 2, 4
Slave 1 : 1, 3, 5
--> slaveNumber == partitionNr % slaveCount

Parameters:
slaveCount -
slaveNumber -

getRepositoryDirectory

public RepositoryDirectoryInterface getRepositoryDirectory()
Not supported for Partition schema, return the root.

Specified by:
getRepositoryDirectory in interface RepositoryElementInterface

setRepositoryDirectory

public void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
Specified by:
setRepositoryDirectory in interface RepositoryElementInterface

getRepositoryElementType

public RepositoryObjectType getRepositoryElementType()
Description copied from interface: RepositoryElementInterface
Gets the repository element type.

Specified by:
getRepositoryElementType in interface RepositoryElementInterface
Returns:
the repository element type

setObjectId

public void setObjectId(ObjectId id)
Description copied from interface: RepositoryElementInterface
Set the database ID for this object in the repository.

Specified by:
setObjectId in interface RepositoryElementInterface
Parameters:
id - the database ID for this object in the repository

getObjectRevision

public ObjectRevision getObjectRevision()
Description copied from interface: RepositoryElementInterface
Gets the object revision.

Specified by:
getObjectRevision in interface RepositoryElementInterface
Returns:
the object revision

setObjectRevision

public void setObjectRevision(ObjectRevision objectRevision)
Description copied from interface: RepositoryElementInterface
Sets the object revision.

Specified by:
setObjectRevision in interface RepositoryElementInterface

setDescription

public void setDescription(String description)
Description copied from interface: RepositoryElementInterface
Sets the description of the repository object.

Specified by:
setDescription in interface RepositoryElementInterface

getChangedDate

public Date getChangedDate()
Specified by:
getChangedDate in interface SharedObjectInterface
Returns:
the changedDate

setChangedDate

public void setChangedDate(Date changedDate)
Parameters:
changedDate - the changedDate to set