org.apache.camel.component.gae.task
Class GTaskBinding

java.lang.Object
  extended by org.apache.camel.component.gae.task.GTaskBinding
All Implemented Interfaces:
InboundBinding<GTaskEndpoint,HttpServletRequest,HttpServletResponse>, OutboundBinding<GTaskEndpoint,com.google.appengine.api.labs.taskqueue.TaskOptions,Void>

public class GTaskBinding
extends Object
implements OutboundBinding<GTaskEndpoint,com.google.appengine.api.labs.taskqueue.TaskOptions,Void>, InboundBinding<GTaskEndpoint,HttpServletRequest,HttpServletResponse>

Binds the TaskOptions of the task queueing service to a Camel Exchange for outbound communication. For inbound communication a HttpMessage is bound to Exchange.


Field Summary
static String GTASK_QUEUE_NAME
          Camel header name corresponding to X-AppEngine-QueueName header created by task queueing service.
static String GTASK_RETRY_COUNT
          Camel header name corresponding to X-AppEngine-TaskRetryCount header created by task queueing service.
static String GTASK_TASK_NAME
          Camel header name corresponding to X-AppEngine-TaskName header created by task queueing service.
 
Constructor Summary
GTaskBinding()
           
 
Method Summary
protected  String getWorkerRoot(GTaskEndpoint endpoint)
           
 Exchange readRequest(GTaskEndpoint endpoint, Exchange exchange, HttpServletRequest request)
          Replaces the task service-specific headers (X-AppEngine-*) with Camel-specific headers.
protected  void readRequestHeaders(GTaskEndpoint endpoint, Exchange exchange, HttpServletRequest request)
           
 Exchange readResponse(GTaskEndpoint endpoint, Exchange exchange, Void response)
          Populates an Exchange from response data and endpoint configuration data.
 com.google.appengine.api.labs.taskqueue.TaskOptions writeRequest(GTaskEndpoint endpoint, Exchange exchange, com.google.appengine.api.labs.taskqueue.TaskOptions request)
          Reads data from exchange and writes it to a newly created TaskOptions instance.
protected  void writeRequestBody(GTaskEndpoint endpoint, Exchange exchange, com.google.appengine.api.labs.taskqueue.TaskOptions request)
           
protected  void writeRequestHeaders(GTaskEndpoint endpoint, Exchange exchange, com.google.appengine.api.labs.taskqueue.TaskOptions request)
           
 HttpServletResponse writeResponse(GTaskEndpoint endpoint, Exchange exchange, HttpServletResponse response)
          Creates or populates a response object from Exchange and endpoint configuration data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GTASK_QUEUE_NAME

public static final String GTASK_QUEUE_NAME
Camel header name corresponding to X-AppEngine-QueueName header created by task queueing service.

See Also:
Constant Field Values

GTASK_TASK_NAME

public static final String GTASK_TASK_NAME
Camel header name corresponding to X-AppEngine-TaskName header created by task queueing service.

See Also:
Constant Field Values

GTASK_RETRY_COUNT

public static final String GTASK_RETRY_COUNT
Camel header name corresponding to X-AppEngine-TaskRetryCount header created by task queueing service.

See Also:
Constant Field Values
Constructor Detail

GTaskBinding

public GTaskBinding()
Method Detail

writeRequest

public com.google.appengine.api.labs.taskqueue.TaskOptions writeRequest(GTaskEndpoint endpoint,
                                                                        Exchange exchange,
                                                                        com.google.appengine.api.labs.taskqueue.TaskOptions request)
Reads data from exchange and writes it to a newly created TaskOptions instance. The request parameter is ignored.

Specified by:
writeRequest in interface OutboundBinding<GTaskEndpoint,com.google.appengine.api.labs.taskqueue.TaskOptions,Void>
Parameters:
endpoint -
exchange -
request - ignored.
Returns:
a newly created TaskOptions instance containing data from exchange.

readResponse

public Exchange readResponse(GTaskEndpoint endpoint,
                             Exchange exchange,
                             Void response)
Description copied from interface: OutboundBinding
Populates an Exchange from response data and endpoint configuration data.

Specified by:
readResponse in interface OutboundBinding<GTaskEndpoint,com.google.appengine.api.labs.taskqueue.TaskOptions,Void>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to be populated or created (if null) from response data.
response - response to read data from.
Returns:
the populated exchange.
Throws:
UnsupportedOperationException

readRequest

public Exchange readRequest(GTaskEndpoint endpoint,
                            Exchange exchange,
                            HttpServletRequest request)
Replaces the task service-specific headers (X-AppEngine-*) with Camel-specific headers.

Specified by:
readRequest in interface InboundBinding<GTaskEndpoint,HttpServletRequest,HttpServletResponse>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to be populated or created (if null) from request data.
request - request to read data from.
Returns:
the populated exchange.
See Also:
GTASK_QUEUE_NAME, GTASK_TASK_NAME, GTASK_RETRY_COUNT, DefaultHttpBinding.readRequest(HttpServletRequest, HttpMessage)

writeResponse

public HttpServletResponse writeResponse(GTaskEndpoint endpoint,
                                         Exchange exchange,
                                         HttpServletResponse response)
Description copied from interface: InboundBinding
Creates or populates a response object from Exchange and endpoint configuration data.

Specified by:
writeResponse in interface InboundBinding<GTaskEndpoint,HttpServletRequest,HttpServletResponse>
Parameters:
endpoint - endpoint providing binding-relevant information.
exchange - exchange to read data from.
response - to be populated or created (if null) from exchange data.
Returns:
the populated response.

writeRequestHeaders

protected void writeRequestHeaders(GTaskEndpoint endpoint,
                                   Exchange exchange,
                                   com.google.appengine.api.labs.taskqueue.TaskOptions request)

readRequestHeaders

protected void readRequestHeaders(GTaskEndpoint endpoint,
                                  Exchange exchange,
                                  HttpServletRequest request)

writeRequestBody

protected void writeRequestBody(GTaskEndpoint endpoint,
                                Exchange exchange,
                                com.google.appengine.api.labs.taskqueue.TaskOptions request)

getWorkerRoot

protected String getWorkerRoot(GTaskEndpoint endpoint)


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.