org.spicefactory.cinnamon.service
Class ServiceProcessor

java.lang.Object
  extended by org.spicefactory.cinnamon.service.ServiceProcessor

public class ServiceProcessor
extends Object

Processes a single request. This involves invoking all ServiceInvokers and the service itself and returning the result.

Author:
Jens Halm

Constructor Summary
ServiceProcessor(ServiceRequest request, ServiceResponse response, ServiceInvoker invoker, Iterator<ServiceInterceptor> interceptors)
          Creates a new ServiceProcessor.
 
Method Summary
 ServiceRequest getRequest()
          Returns the request.
 ServiceResponse getResponse()
          Returns the response.
 Object proceed()
          Proceeds with processing the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceProcessor

public ServiceProcessor(ServiceRequest request,
                        ServiceResponse response,
                        ServiceInvoker invoker,
                        Iterator<ServiceInterceptor> interceptors)
Creates a new ServiceProcessor.

Parameters:
request - the service request
response - the service response
invoker - the ServiceInvoker instance to use
interceptors - the interceptors to invoke before the actual service invocation
Method Detail

getRequest

public ServiceRequest getRequest()
Returns the request.

Returns:
the request

getResponse

public ServiceResponse getResponse()
Returns the response.

Returns:
the response

proceed

public Object proceed()
Proceeds with processing the request. If any ServiceInterceptors are left that have not been invoked then the next one in the interceptor chain will be invoked. If there are no ServiceInterceptors left then the actual service will be invoked. In certain cases a ServiceInterceptor may decide to not call proceed on this ServiceProcessor and return its own result value instead.

Returns:
the result of the service invocation