org.pentaho.platform.plugin.action.examples
Class ComponentImplementationExample

java.lang.Object
  extended by org.pentaho.platform.plugin.action.examples.ComponentImplementationExample
All Implemented Interfaces:
IAuditable, IComponent, ILogger

public class ComponentImplementationExample
extends Object
implements IComponent


Field Summary
 String EMPTYLOGID
           
static String LOGID_MASK1
           
static String LOGID_MASK2
           
static String LOGID_SEPARATOR
           
 
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
ComponentImplementationExample()
           
 
Method Summary
 void createFeedbackParameter(String fieldName, String displayName, String hint, Object defaultValues, List values, Map dispNames, String displayStyle)
           
 String createNewInstance(boolean persisted, Map parameters, boolean forceImmediateWrite)
           
 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.
 void genLogIdFromInfo(String sessId, String procId, String actName)
           
 void genLogIdFromInfo(String sessId, String procId, String actName, String instId)
           
 void genLogIdFromSession(IPentahoSession sess)
           
 org.pentaho.actionsequence.dom.IActionDefinition getActionDefinition()
           
 String getActionName()
          Return the name of the action sequence.
 String getActionTitle()
           
 org.dom4j.Node getComponentDefinition()
           
 String getId()
          Returns a unique id (across classes and instances) for this auditable object.
 String getInitFailMessage()
           
 boolean getInitOk()
           
 String getInstanceId()
           
 org.apache.commons.logging.Log getLogger()
           
 int getLoggingLevel()
          Return the logging level for this Logger.
 String getLogId()
           
 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.
 String getResourceAsString(IActionSequenceResource resource)
           
 IRuntimeContext getRuntimeContext()
           
 IPentahoSession getSession()
           
static String getUserString(String type)
           
 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 inputMissingError(String paramName)
           
 void outputMissingError(String paramName)
           
 void promptNeeded()
           
 void promptNow()
           
 void resourceComponentSettingError(String paramName)
           
 void resourceMissingError(String paramName)
           
 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 logLevel)
          Set the logging level for this Logger.
 void setLogId(String lId)
           
 void setMessages(List messages)
           
 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.
 boolean validateAction()
           
 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
 

Field Detail

LOGID_MASK1

public static final String LOGID_MASK1
See Also:
Constant Field Values

LOGID_MASK2

public static final String LOGID_MASK2
See Also:
Constant Field Values

LOGID_SEPARATOR

public static final String LOGID_SEPARATOR
See Also:
Constant Field Values

EMPTYLOGID

public String EMPTYLOGID
Constructor Detail

ComponentImplementationExample

public ComponentImplementationExample()
Method Detail

validateAction

public boolean validateAction()

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

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

setLogId

public void setLogId(String lId)

getLogger

public org.apache.commons.logging.Log getLogger()

genLogIdFromSession

public void genLogIdFromSession(IPentahoSession sess)

genLogIdFromInfo

public void genLogIdFromInfo(String sessId,
                             String procId,
                             String actName)

genLogIdFromInfo

public void genLogIdFromInfo(String sessId,
                             String procId,
                             String actName,
                             String instId)

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)

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

setLoggingLevel

public void setLoggingLevel(int logLevel)
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

getMessages

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

setMessages

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

getUserString

public static String getUserString(String type)

setInstanceId

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

getInstanceId

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

setActionName

public void setActionName(String actionName)
Specified by:
setActionName 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

setProcessId

public void setProcessId(String processId)
Specified by:
setProcessId 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

setComponentDefinitionMap

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

setComponentDefinition

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

getComponentDefinition

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

setRuntimeContext

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

getRuntimeContext

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

setSession

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

getSession

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

getLogId

public String getLogId()

validate

public final 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

getInitOk

public boolean getInitOk()

promptNeeded

public void promptNeeded()

promptNow

public void promptNow()

getResourceAsString

public String getResourceAsString(IActionSequenceResource resource)

getInitFailMessage

public String getInitFailMessage()

createNewInstance

public String createNewInstance(boolean persisted,
                                Map parameters,
                                boolean forceImmediateWrite)

inputMissingError

public void inputMissingError(String paramName)

outputMissingError

public void outputMissingError(String paramName)

resourceMissingError

public void resourceMissingError(String paramName)

resourceComponentSettingError

public void resourceComponentSettingError(String paramName)

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

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

getActionTitle

public String getActionTitle()

createFeedbackParameter

public void createFeedbackParameter(String fieldName,
                                    String displayName,
                                    String hint,
                                    Object defaultValues,
                                    List values,
                                    Map dispNames,
                                    String displayStyle)

setActionDefinition

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

getActionDefinition

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