org.mule.extras.groovy
Class GroovyComponent

java.lang.Object
  extended byorg.mule.components.script.AbstractScriptComponent
      extended byorg.mule.extras.groovy.GroovyComponent
All Implemented Interfaces:
Callable, Disposable, FileListener, Initialisable, Lifecycle, Startable, Stoppable, UMODescriptorAware, UMOEventListener

public class GroovyComponent
extends AbstractScriptComponent

GroovyComponent allows a grooy object ot managed as a Mule component.

Version:
$Revision: 1.3 $
Author:
Ross Mason

Field Summary
static java.lang.String DEFAULT_METHOD_NAME
           
 
Fields inherited from class org.mule.components.script.AbstractScriptComponent
descriptor, logger
 
Constructor Summary
GroovyComponent()
           
 
Method Summary
 void fileChanged(java.io.File file)
          Called when one of the monitored files are created, deleted or modified.
protected  java.lang.String getDefaultFileExtension()
           
 java.lang.String getMethodName()
           
protected  void loadInterpreter(java.lang.String script)
          Loads the script for this component
 java.lang.Object onCall(UMOEventContext context)
          Passes the context to the listener
 void setMethodName(java.lang.String methodName)
           
 
Methods inherited from class org.mule.components.script.AbstractScriptComponent
dispose, getScript, initialise, isAutoReload, setAutoReload, setDescriptor, setScript, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_METHOD_NAME

public static final java.lang.String DEFAULT_METHOD_NAME
See Also:
Constant Field Values
Constructor Detail

GroovyComponent

public GroovyComponent()
Method Detail

loadInterpreter

protected void loadInterpreter(java.lang.String script)
                        throws InitialisationException
Loads the script for this component

Specified by:
loadInterpreter in class AbstractScriptComponent
Parameters:
script - the script file location
Throws:
InitialisationException - if anything fails while starting up

getDefaultFileExtension

protected java.lang.String getDefaultFileExtension()
Specified by:
getDefaultFileExtension in class AbstractScriptComponent

fileChanged

public void fileChanged(java.io.File file)
                 throws java.io.IOException
Called when one of the monitored files are created, deleted or modified.

Parameters:
file - File which has been changed.
Throws:
java.io.IOException

getMethodName

public java.lang.String getMethodName()

setMethodName

public void setMethodName(java.lang.String methodName)

onCall

public java.lang.Object onCall(UMOEventContext context)
                        throws java.lang.Exception
Passes the context to the listener

Parameters:
context - the context ot process
Returns:
Object this object can be anything. When the UMOLifecycleAdapter for the components receives this object it will first see if the Object is an UMOEvent if not and the Object is not null a new context will be created using the returned object as the payload. This new context will then get published to the configured outbound endpoint if-
  1. One has been configured for the UMO.
  2. the setStopFurtherProcessing(true) wasn't called on the previous context.
Throws:
java.lang.Exception - if the context fails to process properly. If exceptions aren't handled by the implementation they will be handled by the exceptionListener associated with the components


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.