za.org.coefficient.invokers.base
Class BaseInvoker

java.lang.Object
  extended by za.org.coefficient.invokers.base.BaseInvoker
All Implemented Interfaces:
za.co.csir.icomtek.workflow.interfaces.WorkflowModuleInvoker, Invoker
Direct Known Subclasses:
EjbInvoker, WebAppInvoker

public abstract class BaseInvoker
extends java.lang.Object
implements Invoker, za.co.csir.icomtek.workflow.interfaces.WorkflowModuleInvoker

This is an abstract base class that provides most of the funtionality an invoker requires. This allows us to invoke methods on modules, services, and themes without specifiying the methods that know about the environment.

Version:
$Revision: 1.6 $ $Date: 2004/11/09 13:52:11 $
Author:
Dylan Etkin

Field Summary
private static java.lang.String CREATE
           
private static java.lang.String LOCAL
           
 
Constructor Summary
BaseInvoker()
           
 
Method Summary
protected abstract  ModuleLocal getModule(java.lang.String module)
           
abstract  java.lang.Object getService(java.lang.String serviceName)
          This method returns a reference to the named service.
protected abstract  ThemeLocalIf getTheme(java.lang.String theme)
           
 java.lang.Object invoke(CoefficientContext ctx)
          This method will look for a request parameter named module and one named op and will try to fire that operation on the module.
 java.lang.Object invokeGetterOnModule(java.lang.String module, java.lang.String method)
          This method will invoke the named getter on the named module and return the result
 java.lang.Object invokeMethodOnModule(java.lang.String module, java.lang.String method, java.lang.Object[] paramVals)
          This method will invoke the named method on the named module with the parameters provided in the incomming object array and return the result
 java.lang.Object invokeMethodOnService(java.lang.String serviceName, java.lang.String method, java.lang.Object[] paramVals)
          This method will invoke the named method on the named service with the parameters provided in the incomming object array and return the result
 java.lang.Object invokeMethodOnTheme(java.lang.String theme, java.lang.String method, java.lang.Object[] paramVals)
          This method is used to invoke methods on a system service that must be a theme.
 java.lang.Object invokeOpOnModule(java.lang.String module, java.lang.String operation, CoefficientContext ctx)
          This method will invoke the named operation on the named module with the given context as a parameter
 java.lang.Object invokeOpOnModule(java.lang.String module, java.lang.String operation, za.co.csir.icomtek.workflow.interfaces.WorkflowContext ctx)
          NOTE: This is bad and is only done to give the workflow some autonomy This method will invoke the named operation on the named module with the given a workflow context which is a CoefficientContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE

private static final java.lang.String CREATE
See Also:
Constant Field Values

LOCAL

private static final java.lang.String LOCAL
See Also:
Constant Field Values
Constructor Detail

BaseInvoker

public BaseInvoker()
Method Detail

invoke

public java.lang.Object invoke(CoefficientContext ctx)
                        throws java.lang.Exception
This method will look for a request parameter named module and one named op and will try to fire that operation on the module.

Specified by:
invoke in interface Invoker
Throws:
java.lang.Exception

invokeGetterOnModule

public java.lang.Object invokeGetterOnModule(java.lang.String module,
                                             java.lang.String method)
                                      throws java.lang.Exception
Description copied from interface: Invoker
This method will invoke the named getter on the named module and return the result

Specified by:
invokeGetterOnModule in interface Invoker
Parameters:
module - names a module in the system
method - names the getter on the module
Returns:
is the return value of the getter method
Throws:
java.lang.Exception

invokeMethodOnModule

public java.lang.Object invokeMethodOnModule(java.lang.String module,
                                             java.lang.String method,
                                             java.lang.Object[] paramVals)
                                      throws java.lang.Exception
Description copied from interface: Invoker
This method will invoke the named method on the named module with the parameters provided in the incomming object array and return the result

Specified by:
invokeMethodOnModule in interface Invoker
Parameters:
module - names a module available in the system
method - names the method on the module
paramVals - contains the parameters for the method invoke
Returns:
is the return value of the method
Throws:
java.lang.Exception

invokeMethodOnService

public java.lang.Object invokeMethodOnService(java.lang.String serviceName,
                                              java.lang.String method,
                                              java.lang.Object[] paramVals)
                                       throws java.lang.Exception
Description copied from interface: Invoker
This method will invoke the named method on the named service with the parameters provided in the incomming object array and return the result

Specified by:
invokeMethodOnService in interface Invoker
method - names the method on the service
paramVals - contains the parameters for the method invoke
Returns:
is the return value of the method
Throws:
java.lang.Exception

invokeOpOnModule

public java.lang.Object invokeOpOnModule(java.lang.String module,
                                         java.lang.String operation,
                                         CoefficientContext ctx)
                                  throws java.lang.Exception
This method will invoke the named operation on the named module with the given context as a parameter

Specified by:
invokeOpOnModule in interface Invoker
Parameters:
module - names a module in the system
operation - names the method to invoke on the module
ctx - is the coefficient context to be passed to the module
Returns:
is the return value if there is one, null otherwise
Throws:
java.lang.Exception

invokeOpOnModule

public java.lang.Object invokeOpOnModule(java.lang.String module,
                                         java.lang.String operation,
                                         za.co.csir.icomtek.workflow.interfaces.WorkflowContext ctx)
                                  throws java.lang.Exception
NOTE: This is bad and is only done to give the workflow some autonomy This method will invoke the named operation on the named module with the given a workflow context which is a CoefficientContext

Specified by:
invokeOpOnModule in interface za.co.csir.icomtek.workflow.interfaces.WorkflowModuleInvoker
Specified by:
invokeOpOnModule in interface Invoker
Throws:
java.lang.Exception

invokeMethodOnTheme

public java.lang.Object invokeMethodOnTheme(java.lang.String theme,
                                            java.lang.String method,
                                            java.lang.Object[] paramVals)
                                     throws java.lang.Exception
Description copied from interface: Invoker
This method is used to invoke methods on a system service that must be a theme.

Specified by:
invokeMethodOnTheme in interface Invoker
Parameters:
theme - names a theme available in the system, this must be a theme
method - names the method on the service
paramVals - contains the parameters for the method invoke
Returns:
is the return value of the method
Throws:
java.lang.Exception

getService

public abstract java.lang.Object getService(java.lang.String serviceName)
                                     throws java.lang.Exception
Description copied from interface: Invoker
This method returns a reference to the named service. NOTE: this method can only be used by those in the same class loader as the requested service. This is because this returns an EJB created through a local interface, not a remote interface.

Specified by:
getService in interface Invoker
Parameters:
serviceName - is the service available in the system
Returns:
is the service that was requested
Throws:
java.lang.Exception

getTheme

protected abstract ThemeLocalIf getTheme(java.lang.String theme)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getModule

protected abstract ModuleLocal getModule(java.lang.String module)
                                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright CSIR. All Rights Reserved.