org.mule.component.simple
Class StaticComponent

java.lang.Object
  extended by org.mule.component.simple.StaticComponent
All Implemented Interfaces:
Callable, EventListener, Initialisable

public class StaticComponent
extends Object
implements Callable, Initialisable

A service that will return a static data object as a result. This is useful for testing with expected results. The data returned can be read from a file or set as a property on this service.


Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
StaticComponent()
           
 
Method Summary
 Object getData()
           
 String getDataFile()
           
 String getPostfix()
           
 String getPrefix()
           
 void initialise()
          Method used to perform any initialisation work.
 Object onCall(MuleEventContext eventContext)
          Passes the event to the listener
 void setData(Object data)
           
 void setDataFile(String dataFile)
           
 void setPostfix(String postfix)
           
 void setPrefix(String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticComponent

public StaticComponent()
Method Detail

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

getData

public Object getData()

setData

public void setData(Object data)

getDataFile

public String getDataFile()

setDataFile

public void setDataFile(String dataFile)

getPrefix

public String getPrefix()

setPrefix

public void setPrefix(String prefix)

getPostfix

public String getPostfix()

setPostfix

public void setPostfix(String postfix)

onCall

public Object onCall(MuleEventContext eventContext)
              throws Exception
Description copied from interface: Callable
Passes the event to the listener

Specified by:
onCall in interface Callable
Parameters:
eventContext - the context of the current event being process
Returns:
Object this object can be anything. When the LifecycleAdapter for the service receives this object it will first see if the Object is an MuleMessage if not and the Object is not null a new message will be created using the returned object as the payload. This new event will then get published via the configured outbound router if-
  1. One has been configured for the component.
  2. the setStopFurtherProcessing(true) wasn't called on the event context event.
Throws:
Exception - if the event fails to process properly. If exceptions aren't handled by the implementation they will be handled by the exceptionListener associated with the service


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.