org.mule.transport.jcr
Class JcrMessageRequester

java.lang.Object
  extended by org.mule.transport.AbstractTransportMessageHandler
      extended by org.mule.transport.AbstractMessageRequester
          extended by org.mule.transport.jcr.JcrMessageRequester
All Implemented Interfaces:
org.mule.api.lifecycle.Disposable, org.mule.api.lifecycle.Initialisable, org.mule.api.lifecycle.Lifecycle, org.mule.api.lifecycle.LifecycleStateEnabled, org.mule.api.lifecycle.Startable, org.mule.api.lifecycle.Stoppable, org.mule.api.transport.Connectable, org.mule.api.transport.MessageRequester, org.mule.api.transport.MessageRequesting

public class JcrMessageRequester
extends org.mule.transport.AbstractMessageRequester

JcrMessageRequester is responsible for receiving messages from JCR repositories.

Author:
David Dossot (david@dossot.net)

Field Summary
 
Fields inherited from class org.mule.transport.AbstractTransportMessageHandler
connected, connector, endpoint, lifecycleManager, logger, muleMessageFactory, retryTemplate
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Fields inherited from interface org.mule.api.transport.MessageRequesting
REQUEST_NO_WAIT, REQUEST_WAIT_INDEFINITELY
 
Constructor Summary
JcrMessageRequester(org.mule.api.endpoint.InboundEndpoint endpoint)
           
 
Method Summary
protected  void doConnect()
           
protected  void doDisconnect()
           
protected  void doDispose()
           
protected  org.mule.api.MuleMessage doRequest(long ignoredTimeout)
           Receives JCR content from the configured endpoint, using optional event properties to define the target repository item.
 javax.jcr.Session getSession()
           
 
Methods inherited from class org.mule.transport.AbstractMessageRequester
applyInboundTransformers, createLifecycleManager, getEndpoint, getRequesterName, getWorkManager, initialise, request
 
Methods inherited from class org.mule.transport.AbstractTransportMessageHandler
activate, connect, createMuleMessage, createMuleMessage, createMuleMessage, createMuleMessageFactory, createNullMuleMessage, disconnect, dispose, disposeAndLogException, doInitialise, doStart, doStop, getConnectEventId, getConnectionDescription, getConnector, getLifecycleState, initializeMessageFactory, initializeRetryPolicy, isConnected, isDoThreading, isStarted, isStarting, isStopping, passivate, setEndpoint, start, stop, toString, validate, validateConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.transport.MessageRequester
activate, createMuleMessage, createMuleMessage, getConnector, passivate, validate
 
Methods inherited from interface org.mule.api.transport.Connectable
connect, disconnect, getConnectionDescription, isConnected, validateConnection
 
Methods inherited from interface org.mule.api.lifecycle.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.api.lifecycle.LifecycleStateEnabled
getLifecycleState
 

Constructor Detail

JcrMessageRequester

public JcrMessageRequester(org.mule.api.endpoint.InboundEndpoint endpoint)
Method Detail

getSession

public javax.jcr.Session getSession()

doConnect

protected void doConnect()
                  throws Exception
Overrides:
doConnect in class org.mule.transport.AbstractTransportMessageHandler
Throws:
Exception

doDisconnect

protected void doDisconnect()
                     throws Exception
Overrides:
doDisconnect in class org.mule.transport.AbstractTransportMessageHandler
Throws:
Exception

doDispose

protected void doDispose()
Overrides:
doDispose in class org.mule.transport.AbstractTransportMessageHandler

doRequest

protected org.mule.api.MuleMessage doRequest(long ignoredTimeout)
                                      throws Exception

Receives JCR content from the configured endpoint, using optional event properties to define the target repository item. Unless an exception is thrown, a MuleMessage will always be retrieved, possibly with a null payload if no content was acessible.

The content is extracted from the property or properties that were targeted by the endpoint path, filters and event optional parameters.

The first step of the content fetching consists in selecting a target item from the repository. By default, this item is a node selected by using the path of the endpoint. Alternatively, an event property ( JcrConnector.JCR_NODE_UUID_PROPERTY) can be used to specify the UUID to use to select the target node: if this is done, the endpoint URI will be ignored. A third option is to define a query (with queryStatement and queryLanguage) that will be used to select the node. Then, if any optional relative paths have been specified as event properties for the current MuleEvent ( JcrConnector.JCR_NODE_RELPATH_PROPERTY and/or JcrConnector.JCR_PROPERTY_REL_PATH_PROPERTY), they will be used to navigate to the actual item to use.

The second step consists in applying any JcrNodeNameFilter or JcrPropertyNameFilter that could have been defined on the endpoint to further narrow the target item from which content will be extracted. If more than one node is selected, the first one will be arbitrarily used as the target item and a warning will be issued. If no item can be selected, a null payload will be used for the returned MuleMessage.

The final step is the content extraction that will be used as the MuleMessage payload. For this, the following rules apply, depending on the target item:

Specified by:
doRequest in class org.mule.transport.AbstractMessageRequester
Parameters:
ignoredTimeout - ignored timeout parameter.
Returns:
the message fetched from this dispatcher.
Throws:
Exception
See Also:
Property names constants


Copyright © 2011. All Rights Reserved.