org.pentaho.di.cluster
Class SlaveServer

java.lang.Object
  extended by org.pentaho.di.core.changed.ChangedFlag
      extended by org.pentaho.di.cluster.SlaveServer
All Implemented Interfaces:
Cloneable, ChangedFlagInterface, org.pentaho.di.core.variables.VariableSpace, org.pentaho.di.core.xml.XMLInterface, org.pentaho.di.repository.RepositoryElementInterface, org.pentaho.di.repository.RepositoryObjectInterface, org.pentaho.di.shared.SharedObjectInterface

public class SlaveServer
extends ChangedFlag
implements Cloneable, org.pentaho.di.shared.SharedObjectInterface, org.pentaho.di.core.variables.VariableSpace, org.pentaho.di.repository.RepositoryElementInterface, org.pentaho.di.core.xml.XMLInterface


Field Summary
static org.pentaho.di.repository.RepositoryObjectType REPOSITORY_ELEMENT_TYPE
           
static String STRING_SLAVESERVER
           
static String XML_TAG
           
 
Constructor Summary
SlaveServer()
           
SlaveServer(Node slaveNode)
           
SlaveServer(String name, String hostname, String port, String username, String password)
           
SlaveServer(String name, String hostname, String port, String username, String password, String proxyHostname, String proxyPort, String nonProxyHosts, boolean master)
           
 
Method Summary
 void addCredentials(org.apache.commons.httpclient.HttpClient client)
           
 void addProxy(org.apache.commons.httpclient.HttpClient client)
           
 int allocateServerSocket(String runId, int portRangeStart, String hostname, String transformationName, String sourceSlaveName, String sourceStepName, String sourceStepCopy, String targetSlaveName, String targetStepName, String targetStepCopy)
           
 WebResult cleanupTransformation(String transName, String carteObjectId)
           
 Object clone()
           
 String constructUrl(String serviceAndArguments)
           
 void copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
           
 WebResult deAllocateServerSockets(String transName, String clusteredRunId)
           
 String environmentSubstitute(String aString)
           
 String[] environmentSubstitute(String[] aString)
           
 boolean equals(Object obj)
           
 String execService(String service)
           
static SlaveServer findSlaveServer(List<SlaveServer> slaveServers, org.pentaho.di.repository.ObjectId id)
           
static SlaveServer findSlaveServer(List<SlaveServer> slaveServers, String name)
           
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
           
 Date getChangedDate()
           
 String getDescription()
           
 String getHostname()
           
 SlaveServerJobStatus getJobStatus(String jobName, String carteObjectId, int startLogLineNr)
           
 String getName()
           
 long getNextSlaveSequenceValue(String slaveSequenceName, long incrementValue)
           
 String getNonProxyHosts()
           
 org.pentaho.di.repository.ObjectId getObjectId()
           
 org.pentaho.di.repository.ObjectRevision getObjectRevision()
           
 org.pentaho.di.core.variables.VariableSpace getParentVariableSpace()
           
 String getPassword()
           
 String getPort()
           
 String getPortSpecification()
           
 String getProxyHostname()
           
 String getProxyPort()
           
 org.pentaho.di.repository.RepositoryDirectoryInterface getRepositoryDirectory()
          Not used in this case, simply return root /
 org.pentaho.di.repository.RepositoryObjectType getRepositoryElementType()
           
 org.apache.commons.httpclient.methods.PostMethod getSendByteArrayMethod(byte[] content, String service)
           
 String getServerAndPort()
           
 List<SlaveServerDetection> getSlaveServerDetections()
           
static String[] getSlaveServerNames(List<SlaveServer> slaveServers)
           
 SlaveServerStatus getStatus()
           
 SlaveServerTransStatus getTransStatus(String transName, String carteObjectId, int startLogLineNr)
           
 String getUsername()
           
 String getVariable(String variableName)
           
 String getVariable(String variableName, String defaultValue)
           
 String getWebAppName()
           
 String getXML()
           
 int hashCode()
           
 void initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
           
 void injectVariables(Map<String,String> prop)
           
 boolean isMaster()
           
 boolean isShared()
           
 String[] listVariables()
           
 WebResult pauseResumeTransformation(String transName, String carteObjectId)
           
 WebResult removeJob(String jobName, String carteObjectId)
           
 WebResult removeTransformation(String transName, String carteObjectId)
           
 void replaceMeta(SlaveServer slaveServer)
           
 String sendExport(String filename, String type, String load)
          Send an exported archive over to this slave server
 String sendXML(String xml, String service)
           
 void setChangedDate(Date changedDate)
           
 void setDescription(String description)
           
 void setHostname(String urlString)
           
 void setMaster(boolean master)
           
 void setName(String name)
           
 void setNonProxyHosts(String nonProxyHosts)
           
 void setObjectId(org.pentaho.di.repository.ObjectId id)
           
 void setObjectRevision(org.pentaho.di.repository.ObjectRevision objectRevision)
           
 void setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
           
 void setPassword(String password)
           
 void setPort(String port)
           
 void setProxyHostname(String proxyHostname)
           
 void setProxyPort(String proxyPort)
           
 void setRepositoryDirectory(org.pentaho.di.repository.RepositoryDirectoryInterface repositoryDirectory)
           
 void setShared(boolean shared)
           
 void setUsername(String username)
           
 void setVariable(String variableName, String variableValue)
           
 void setWebAppName(String webAppName)
           
 void shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
           
 String sniffStep(String transName, String stepName, String copyNr, int lines, String type)
          Sniff rows on a the slave server, return xml containing the row metadata and data.
 WebResult startJob(String jobName, String carteObjectId)
           
 WebResult startTransformation(String transName, String carteObjectId)
           
 WebResult stopJob(String transName, String carteObjectId)
           
 WebResult stopTransformation(String transName, String carteObjectId)
           
 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

STRING_SLAVESERVER

public static final String STRING_SLAVESERVER
See Also:
Constant Field Values

XML_TAG

public static final String XML_TAG
See Also:
Constant Field Values

REPOSITORY_ELEMENT_TYPE

public static final org.pentaho.di.repository.RepositoryObjectType REPOSITORY_ELEMENT_TYPE
Constructor Detail

SlaveServer

public SlaveServer()

SlaveServer

public SlaveServer(String name,
                   String hostname,
                   String port,
                   String username,
                   String password)

SlaveServer

public SlaveServer(String name,
                   String hostname,
                   String port,
                   String username,
                   String password,
                   String proxyHostname,
                   String proxyPort,
                   String nonProxyHosts,
                   boolean master)

SlaveServer

public SlaveServer(Node slaveNode)
Method Detail

getXML

public String getXML()
Specified by:
getXML in interface org.pentaho.di.core.xml.XMLInterface
Specified by:
getXML in interface org.pentaho.di.shared.SharedObjectInterface

clone

public Object clone()
Overrides:
clone in class Object

replaceMeta

public void replaceMeta(SlaveServer slaveServer)

toString

public String toString()
Overrides:
toString in class Object

getServerAndPort

public String getServerAndPort()

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getHostname

public String getHostname()

setHostname

public void setHostname(String urlString)

getPassword

public String getPassword()
Returns:
the password

setPassword

public void setPassword(String password)
Parameters:
password - the password to set

getUsername

public String getUsername()
Returns:
the username

setUsername

public void setUsername(String username)
Parameters:
username - the username to set

getWebAppName

public String getWebAppName()
Returns:
the username

setWebAppName

public void setWebAppName(String webAppName)
Parameters:
username - the username to set

getNonProxyHosts

public String getNonProxyHosts()
Returns:
the nonProxyHosts

setNonProxyHosts

public void setNonProxyHosts(String nonProxyHosts)
Parameters:
nonProxyHosts - the nonProxyHosts to set

getProxyHostname

public String getProxyHostname()
Returns:
the proxyHostname

setProxyHostname

public void setProxyHostname(String proxyHostname)
Parameters:
proxyHostname - the proxyHostname to set

getProxyPort

public String getProxyPort()
Returns:
the proxyPort

setProxyPort

public void setProxyPort(String proxyPort)
Parameters:
proxyPort - the proxyPort to set

getPortSpecification

public String getPortSpecification()

constructUrl

public String constructUrl(String serviceAndArguments)
                    throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

getPort

public String getPort()
Returns:
the port

setPort

public void setPort(String port)
Parameters:
port - the port to set

getSendByteArrayMethod

public org.apache.commons.httpclient.methods.PostMethod getSendByteArrayMethod(byte[] content,
                                                                               String service)
                                                                        throws Exception
Throws:
Exception

sendXML

public String sendXML(String xml,
                      String service)
               throws Exception
Throws:
Exception

sendExport

public String sendExport(String filename,
                         String type,
                         String load)
                  throws Exception
Send an exported archive over to this slave server

Parameters:
filename - The archive to send
type - The type of file to add to the slave server (AddExportServlet.TYPE_*)
load - The filename to load in the archive (the .kjb or .ktr)
Returns:
the XML of the web result
Throws:
Exception - in case something goes awry

addProxy

public void addProxy(org.apache.commons.httpclient.HttpClient client)

addCredentials

public void addCredentials(org.apache.commons.httpclient.HttpClient client)

isMaster

public boolean isMaster()
Returns:
the master

setMaster

public void setMaster(boolean master)
Parameters:
master - the master to set

execService

public String execService(String service)
                   throws Exception
Throws:
Exception

getStatus

public SlaveServerStatus getStatus()
                            throws Exception
Throws:
Exception

getSlaveServerDetections

public List<SlaveServerDetection> getSlaveServerDetections()
                                                    throws Exception
Throws:
Exception

getTransStatus

public SlaveServerTransStatus getTransStatus(String transName,
                                             String carteObjectId,
                                             int startLogLineNr)
                                      throws Exception
Throws:
Exception

getJobStatus

public SlaveServerJobStatus getJobStatus(String jobName,
                                         String carteObjectId,
                                         int startLogLineNr)
                                  throws Exception
Throws:
Exception

stopTransformation

public WebResult stopTransformation(String transName,
                                    String carteObjectId)
                             throws Exception
Throws:
Exception

pauseResumeTransformation

public WebResult pauseResumeTransformation(String transName,
                                           String carteObjectId)
                                    throws Exception
Throws:
Exception

removeTransformation

public WebResult removeTransformation(String transName,
                                      String carteObjectId)
                               throws Exception
Throws:
Exception

removeJob

public WebResult removeJob(String jobName,
                           String carteObjectId)
                    throws Exception
Throws:
Exception

stopJob

public WebResult stopJob(String transName,
                         String carteObjectId)
                  throws Exception
Throws:
Exception

startTransformation

public WebResult startTransformation(String transName,
                                     String carteObjectId)
                              throws Exception
Throws:
Exception

startJob

public WebResult startJob(String jobName,
                          String carteObjectId)
                   throws Exception
Throws:
Exception

cleanupTransformation

public WebResult cleanupTransformation(String transName,
                                       String carteObjectId)
                                throws Exception
Throws:
Exception

deAllocateServerSockets

public WebResult deAllocateServerSockets(String transName,
                                         String clusteredRunId)
                                  throws Exception
Throws:
Exception

findSlaveServer

public static SlaveServer findSlaveServer(List<SlaveServer> slaveServers,
                                          String name)

findSlaveServer

public static SlaveServer findSlaveServer(List<SlaveServer> slaveServers,
                                          org.pentaho.di.repository.ObjectId id)

getSlaveServerNames

public static String[] getSlaveServerNames(List<SlaveServer> slaveServers)

allocateServerSocket

public int allocateServerSocket(String runId,
                                int portRangeStart,
                                String hostname,
                                String transformationName,
                                String sourceSlaveName,
                                String sourceStepName,
                                String sourceStepCopy,
                                String targetSlaveName,
                                String targetStepName,
                                String targetStepCopy)
                         throws Exception
Throws:
Exception

getName

public String getName()
Specified by:
getName in interface org.pentaho.di.repository.RepositoryElementInterface
Specified by:
getName in interface org.pentaho.di.repository.RepositoryObjectInterface
Specified by:
getName in interface org.pentaho.di.shared.SharedObjectInterface

setName

public void setName(String name)
Specified by:
setName in interface org.pentaho.di.repository.RepositoryElementInterface

isShared

public boolean isShared()
Specified by:
isShared in interface org.pentaho.di.shared.SharedObjectInterface

setShared

public void setShared(boolean shared)
Specified by:
setShared in interface org.pentaho.di.shared.SharedObjectInterface

copyVariablesFrom

public void copyVariablesFrom(org.pentaho.di.core.variables.VariableSpace space)
Specified by:
copyVariablesFrom in interface org.pentaho.di.core.variables.VariableSpace

environmentSubstitute

public String environmentSubstitute(String aString)
Specified by:
environmentSubstitute in interface org.pentaho.di.core.variables.VariableSpace

environmentSubstitute

public String[] environmentSubstitute(String[] aString)
Specified by:
environmentSubstitute in interface org.pentaho.di.core.variables.VariableSpace

getParentVariableSpace

public org.pentaho.di.core.variables.VariableSpace getParentVariableSpace()
Specified by:
getParentVariableSpace in interface org.pentaho.di.core.variables.VariableSpace

setParentVariableSpace

public void setParentVariableSpace(org.pentaho.di.core.variables.VariableSpace parent)
Specified by:
setParentVariableSpace in interface org.pentaho.di.core.variables.VariableSpace

getVariable

public String getVariable(String variableName,
                          String defaultValue)
Specified by:
getVariable in interface org.pentaho.di.core.variables.VariableSpace

getVariable

public String getVariable(String variableName)
Specified by:
getVariable in interface org.pentaho.di.core.variables.VariableSpace

getBooleanValueOfVariable

public boolean getBooleanValueOfVariable(String variableName,
                                         boolean defaultValue)
Specified by:
getBooleanValueOfVariable in interface org.pentaho.di.core.variables.VariableSpace

initializeVariablesFrom

public void initializeVariablesFrom(org.pentaho.di.core.variables.VariableSpace parent)
Specified by:
initializeVariablesFrom in interface org.pentaho.di.core.variables.VariableSpace

listVariables

public String[] listVariables()
Specified by:
listVariables in interface org.pentaho.di.core.variables.VariableSpace

setVariable

public void setVariable(String variableName,
                        String variableValue)
Specified by:
setVariable in interface org.pentaho.di.core.variables.VariableSpace

shareVariablesWith

public void shareVariablesWith(org.pentaho.di.core.variables.VariableSpace space)
Specified by:
shareVariablesWith in interface org.pentaho.di.core.variables.VariableSpace

injectVariables

public void injectVariables(Map<String,String> prop)
Specified by:
injectVariables in interface org.pentaho.di.core.variables.VariableSpace

getObjectId

public org.pentaho.di.repository.ObjectId getObjectId()
Specified by:
getObjectId in interface org.pentaho.di.repository.RepositoryElementInterface
Specified by:
getObjectId in interface org.pentaho.di.repository.RepositoryObjectInterface

setObjectId

public void setObjectId(org.pentaho.di.repository.ObjectId id)
Specified by:
setObjectId in interface org.pentaho.di.repository.RepositoryElementInterface

getRepositoryDirectory

public org.pentaho.di.repository.RepositoryDirectoryInterface getRepositoryDirectory()
Not used in this case, simply return root /

Specified by:
getRepositoryDirectory in interface org.pentaho.di.repository.RepositoryElementInterface

setRepositoryDirectory

public void setRepositoryDirectory(org.pentaho.di.repository.RepositoryDirectoryInterface repositoryDirectory)
Specified by:
setRepositoryDirectory in interface org.pentaho.di.repository.RepositoryElementInterface

getRepositoryElementType

public org.pentaho.di.repository.RepositoryObjectType getRepositoryElementType()
Specified by:
getRepositoryElementType in interface org.pentaho.di.repository.RepositoryElementInterface

getObjectRevision

public org.pentaho.di.repository.ObjectRevision getObjectRevision()
Specified by:
getObjectRevision in interface org.pentaho.di.repository.RepositoryElementInterface

setObjectRevision

public void setObjectRevision(org.pentaho.di.repository.ObjectRevision objectRevision)
Specified by:
setObjectRevision in interface org.pentaho.di.repository.RepositoryElementInterface

getDescription

public String getDescription()
Specified by:
getDescription in interface org.pentaho.di.repository.RepositoryElementInterface

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface org.pentaho.di.repository.RepositoryElementInterface

sniffStep

public String sniffStep(String transName,
                        String stepName,
                        String copyNr,
                        int lines,
                        String type)
                 throws Exception
Sniff rows on a the slave server, return xml containing the row metadata and data.

Parameters:
transName -
stepName -
copyNr -
lines -
Returns:
Throws:
Exception

getNextSlaveSequenceValue

public long getNextSlaveSequenceValue(String slaveSequenceName,
                                      long incrementValue)
                               throws org.pentaho.di.core.exception.KettleException
Throws:
org.pentaho.di.core.exception.KettleException

getChangedDate

public Date getChangedDate()
Specified by:
getChangedDate in interface org.pentaho.di.shared.SharedObjectInterface
Returns:
the changedDate

setChangedDate

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