Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.soa.esb.listeners.gateway
Class GroovyGateway

    java.lang.Object
      org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
          org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle
              org.jboss.soa.esb.listeners.gateway.GroovyGateway

All Implemented Interfaces:
  java.io.Serializable, java.lang.Runnable, ManagedLifecycle

    public class GroovyGateway

extends AbstractThreadedManagedLifecycle

Gateway listener that start the supplied Groovy script.

The Groovy script effectively becomes the gateway listener. The script path (classpath) is specified in the "script" configuration property.

The script is injected with references to the `config` ("config"), a `UncomposedMessageDeliveryAdapter` instance for its target service ("deliveryAdapter"), and a reference to the gateway lifecycle instance ("gateway").

### Sample Config

      <groovy-listener name="soap-client" script="/org/jboss/scripts/MyScript.groovy" is-gateway="true" />

### Sample Script

      def stopped = false;
      println "Starting loop in listener..."
      while(!stopped) {
          print "."
          stopped = gateway.waitUntilStopping(200);
      }
      println ""
      println "loop ended"

      println "delivering message..."
      deliveryAdapter.deliverAsync(config.getAttribute("xxxx"));

Author:
  tom.fennelly@jboss.com
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
`PARAM_TERMINATION_PERIOD`

Constructor Summary
`GroovyGateway(ConfigTree config)` Construct the threaded managed lifecycle.

Method Summary
`protected UncomposedMessageDeliveryAdapter` | `createDeliveryAdapter()` Factory method for adapter creation.
`protected void` | `doInitialise()` Handle the initialisation of the managed instance.
`protected void` | `doRun()` Execute on the thread.

Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle
`addManagedLifecycleThreadEventListener, doDestroy, doStart, doStop, doThreadedDestroy, isRunning, isStopped, isStopping, removeManagedLifecycleThreadEventListener, run, setRunning, waitForRunningStateChange, waitUntilStopped, waitUntilStopped, waitUntilStopping`

Methods inherited from class org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle
`addManagedLifecycleEventListener, changeState, destroy, getConfig, getState, getTerminationPeriod, initialise, removeManagedLifecycleEventListener, start, stop, waitUntilDestroyed, waitUntilDestroyed, waitUntilNotState, waitUntilState`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GroovyGateway

    public GroovyGateway(ConfigTree config)
                  throws ConfigurationException

  Construct the threaded managed lifecycle.

  Parameters:
    `config` - The configuration associated with this instance.
  Throws:
    `ConfigurationException` - for configuration errors during initialisation.

Method Detail

### doInitialise

    protected void doInitialise()
                         throws ManagedLifecycleException

  Description copied from class: `AbstractManagedLifecycle`
  Handle the initialisation of the managed instance.

  Specified by:
    `doInitialise` in class `AbstractManagedLifecycle`
  Throws:
    `ManagedLifecycleException` - for errors while initialisation.

### doRun

    protected void doRun()

  Description copied from class: `AbstractThreadedManagedLifecycle`
  Execute on the thread.

  Specified by:
    `doRun` in class `AbstractThreadedManagedLifecycle`

### createDeliveryAdapter

    protected UncomposedMessageDeliveryAdapter createDeliveryAdapter()
                                                              throws ConfigurationException

  Factory method for adapter creation.

  Returns:
    The adapter instance.
  Throws:
    `ConfigurationException` - Configuration error.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD