org.pentaho.test.platform.engine.core
Class MockComponent

java.lang.Object
  extended by org.pentaho.test.platform.engine.core.MockComponent
All Implemented Interfaces:
IAuditable, IComponent, ILogger

public class MockComponent
extends Object
implements IComponent


Field Summary
 
Fields inherited from interface org.pentaho.platform.api.engine.ILogger
ACTIVITY_LOG, DEBUG, ERROR, FATAL, INFO, INSTANCE_LOG, SESSION_LOG, SOLUTION_LOG, TRACE, UNKNOWN, WARN
 
Constructor Summary
MockComponent()
           
 
Method Summary
 void debug(String message)
          Log a message object with the DEBUG Level.
 void debug(String message, Throwable error)
          Log a message with the DEBUG level including the stack trace of the Throwable error passed as parameter.
 void done()
          Allows the component to perform any cleanup after the execution of the action.
 void error(String message)
          Log a message object with the ERROR Level.
 void error(String message, Throwable error)
          Log a message with the ERROR level including the stack trace of the Throwable error passed as parameter.
 int execute()
          Perform the Component execution; logic for what this Component does goes here.
 void fatal(String message)
          Log a message object with the FATAL Level.
 void fatal(String message, Throwable error)
          Log a message with the FATAL level including the stack trace of the Throwable error passed as parameter.
 org.pentaho.actionsequence.dom.IActionDefinition getActionDefinition()
           
 String getActionName()
          Return the name of the action sequence.
 org.dom4j.Node getComponentDefinition()
           
 String getId()
          Returns a unique id (across classes and instances) for this auditable object.
 String getInstanceId()
           
 int getLoggingLevel()
          Return the logging level for this Logger.
 List getMessages()
           
 String getObjectName()
          Returns the Java class name for this object.
 String getProcessId()
          Return the id for the execution of a given action sequence document.
 IRuntimeContext getRuntimeContext()
           
 IPentahoSession getSession()
           
 void info(String message)
          Log a message object with the INFO Level.
 void info(String message, Throwable error)
          Log a message with the INFO level including the stack trace of the Throwable error passed as parameter.
 boolean init()
          Initialize the Component.
 void setActionDefinition(org.pentaho.actionsequence.dom.IActionDefinition actionDefinition)
           
 void setActionName(String actionName)
           
 void setComponentDefinition(org.dom4j.Node componentDefinition)
           
 void setComponentDefinitionMap(Map<String,String> componentDefinitionMap)
           
 void setInstanceId(String instanceId)
           
 void setLoggingLevel(int loggingLevel)
          Set the logging level for this Logger.
 void setMessages(List messaes)
           
 void setProcessId(String processId)
           
 void setRuntimeContext(IRuntimeContext runtimeContext)
           
 void setSession(IPentahoSession session)
           
 void trace(String message)
          Log a message object with the TRACE Level.
 void trace(String message, Throwable error)
          Log a message with the TRACE level including the stack trace of the Throwable error passed as parameter.
 int validate()
          Validate that the Component has all the necessary inputs, outputs and resources it needs to execute successfully.
 void warn(String message)
          Log a message object with the WARN Level.
 void warn(String message, Throwable error)
          Log a message with the WARN level including the stack trace of the Throwable error passed as parameter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockComponent

public MockComponent()
Method Detail

done

public void done()
Description copied from interface: IComponent
Allows the component to perform any cleanup after the execution of the action.

Specified by:
done in interface IComponent

execute

public int execute()
Description copied from interface: IComponent
Perform the Component execution; logic for what this Component does goes here.

Specified by:
execute in interface IComponent
Returns:
one of IRuntimeContext execution conditions
See Also:
IRuntimeContext

getActionDefinition

public org.pentaho.actionsequence.dom.IActionDefinition getActionDefinition()
Specified by:
getActionDefinition in interface IComponent

getActionName

public String getActionName()
Description copied from interface: IAuditable
Return the name of the action sequence. Today, that name is synonymous with the name of the action sequence document in the solution repository.

Specified by:
getActionName in interface IAuditable
Specified by:
getActionName in interface IComponent
Returns:
the name of the action sequence

getComponentDefinition

public org.dom4j.Node getComponentDefinition()
Specified by:
getComponentDefinition in interface IComponent

getInstanceId

public String getInstanceId()
Specified by:
getInstanceId in interface IComponent

getMessages

public List getMessages()
Specified by:
getMessages in interface IComponent

getProcessId

public String getProcessId()
Description copied from interface: IAuditable
Return the id for the execution of a given action sequence document.

Specified by:
getProcessId in interface IAuditable
Specified by:
getProcessId in interface IComponent
Returns:
the process id

getRuntimeContext

public IRuntimeContext getRuntimeContext()
Specified by:
getRuntimeContext in interface IComponent

getSession

public IPentahoSession getSession()
Specified by:
getSession in interface IComponent

init

public boolean init()
Description copied from interface: IComponent
Initialize the Component. This method is typically called on construction.

Specified by:
init in interface IComponent
Returns:
returns true if the Component initialized successfully, otherwise returns false

setActionDefinition

public void setActionDefinition(org.pentaho.actionsequence.dom.IActionDefinition actionDefinition)
Specified by:
setActionDefinition in interface IComponent

setActionName

public void setActionName(String actionName)
Specified by:
setActionName in interface IComponent

setComponentDefinition

public void setComponentDefinition(org.dom4j.Node componentDefinition)
Specified by:
setComponentDefinition in interface IComponent

setComponentDefinitionMap

public void setComponentDefinitionMap(Map<String,String> componentDefinitionMap)
Specified by:
setComponentDefinitionMap in interface IComponent

setInstanceId

public void setInstanceId(String instanceId)
Specified by:
setInstanceId in interface IComponent

setMessages

public void setMessages(List messaes)
Specified by:
setMessages in interface IComponent

setProcessId

public void setProcessId(String processId)
Specified by:
setProcessId in interface IComponent

setRuntimeContext

public void setRuntimeContext(IRuntimeContext runtimeContext)
Specified by:
setRuntimeContext in interface IComponent

setSession

public void setSession(IPentahoSession session)
Specified by:
setSession in interface IComponent

validate

public int validate()
Description copied from interface: IComponent
Validate that the Component has all the necessary inputs, outputs and resources it needs to execute successfully. Also may validate a schema here.

Specified by:
validate in interface IComponent
Returns:
one of IRuntimeContext validation conditions
See Also:
IRuntimeContext

getId

public String getId()
Description copied from interface: IAuditable
Returns a unique id (across classes and instances) for this auditable object.

Specified by:
getId in interface IAuditable
Returns:
the auditable's id

getObjectName

public String getObjectName()
Description copied from interface: IAuditable
Returns the Java class name for this object.

Specified by:
getObjectName in interface IAuditable
Returns:
the name of the object (the Java class name)

debug

public void debug(String message)
Description copied from interface: ILogger
Log a message object with the DEBUG Level.

Specified by:
debug in interface ILogger
Parameters:
message - the message object to log.

debug

public void debug(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the DEBUG level including the stack trace of the Throwable error passed as parameter.

Specified by:
debug in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

error

public void error(String message)
Description copied from interface: ILogger
Log a message object with the ERROR Level.

Specified by:
error in interface ILogger
Parameters:
message - the message object to log.

error

public void error(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the ERROR level including the stack trace of the Throwable error passed as parameter.

Specified by:
error in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

fatal

public void fatal(String message)
Description copied from interface: ILogger
Log a message object with the FATAL Level.

Specified by:
fatal in interface ILogger
Parameters:
message - the message object to log.

fatal

public void fatal(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the FATAL level including the stack trace of the Throwable error passed as parameter.

Specified by:
fatal in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

getLoggingLevel

public int getLoggingLevel()
Description copied from interface: ILogger
Return the logging level for this Logger.

Specified by:
getLoggingLevel in interface ILogger
Returns:
logging level

info

public void info(String message)
Description copied from interface: ILogger
Log a message object with the INFO Level.

Specified by:
info in interface ILogger
Parameters:
message - the message object to log.

info

public void info(String message,
                 Throwable error)
Description copied from interface: ILogger
Log a message with the INFO level including the stack trace of the Throwable error passed as parameter.

Specified by:
info in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

setLoggingLevel

public void setLoggingLevel(int loggingLevel)
Description copied from interface: ILogger
Set the logging level for this Logger.

Valid logging levels are TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.

Specified by:
setLoggingLevel in interface ILogger

trace

public void trace(String message)
Description copied from interface: ILogger
Log a message object with the TRACE Level.

Specified by:
trace in interface ILogger
Parameters:
message - the message object to log.

trace

public void trace(String message,
                  Throwable error)
Description copied from interface: ILogger
Log a message with the TRACE level including the stack trace of the Throwable error passed as parameter.

Specified by:
trace in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.

warn

public void warn(String message)
Description copied from interface: ILogger
Log a message object with the WARN Level.

Specified by:
warn in interface ILogger
Parameters:
message - the message object to log.

warn

public void warn(String message,
                 Throwable error)
Description copied from interface: ILogger
Log a message with the WARN level including the stack trace of the Throwable error passed as parameter.

Specified by:
warn in interface ILogger
Parameters:
message - the message object to log.
error - the exception to log, including its stack trace.