org.sr.server
Interface IInterceptor<E>

Type Parameters:
E -
All Known Subinterfaces:
IJSONCallInterceptor

public interface IInterceptor<E>

Interceptors are designed to filter message traffic and execute some additional tasks around operation execution. Interceptors are great places to enforce generic policies.They can access message headers as well as operation parameters.

Author:
Serhat Dirik

Method Summary
 java.lang.Object afterMethodCall(ICallerContextInfo<?> context, E request, org.sr.common.entitydef.ServiceDefinition serviceDef, org.sr.common.entitydef.OperationDefinition opDef, java.lang.Object serviceInstance, java.lang.Object[] parameters, java.lang.Object result)
          Callers executes this method right after they execute the targeted operation
 void afterReceived(ICallerContextInfo<?> context, E request, org.sr.common.entitydef.ServiceDefinition serviceDef, org.sr.common.entitydef.OperationDefinition opDef)
          Callers executes this method immediately after a message is received by them.
 void beforeMethodCall(ICallerContextInfo<?> context, E request, org.sr.common.entitydef.ServiceDefinition serviceDef, org.sr.common.entitydef.OperationDefinition opDef, java.lang.Object serviceInstance, java.lang.Object[] parameters)
          Callers executes this method before they execute targeted service operation
 E beforeSent(ICallerContextInfo<?> context, E request, E response, org.sr.common.entitydef.ServiceDefinition serviceDef, org.sr.common.entitydef.OperationDefinition opDef, java.lang.Object serviceInstance, java.lang.Object[] parameters)
          Callers executes this method right before they send the result to the caller
 

Method Detail

afterReceived

void afterReceived(ICallerContextInfo<?> context,
                   E request,
                   org.sr.common.entitydef.ServiceDefinition serviceDef,
                   org.sr.common.entitydef.OperationDefinition opDef)
                   throws ServiceCallException
Callers executes this method immediately after a message is received by them. All parameters are passed by their value so that the interceptors can change their values.

Parameters:
context - caller context information
request - Incoming message
serviceDef - target service definition to be called
opDef - target operation definition to be called
Throws:
ServiceCallException

beforeMethodCall

void beforeMethodCall(ICallerContextInfo<?> context,
                      E request,
                      org.sr.common.entitydef.ServiceDefinition serviceDef,
                      org.sr.common.entitydef.OperationDefinition opDef,
                      java.lang.Object serviceInstance,
                      java.lang.Object[] parameters)
                      throws ServiceCallException
Callers executes this method before they execute targeted service operation

Parameters:
context - caller context information
request - incoming message
serviceDef - target service definition to be called
opDef - target operation definition to be called
serviceInstance - instance of target service to be called
parameters - java object parameters of the targeted operation
Throws:
ServiceCallException

afterMethodCall

java.lang.Object afterMethodCall(ICallerContextInfo<?> context,
                                 E request,
                                 org.sr.common.entitydef.ServiceDefinition serviceDef,
                                 org.sr.common.entitydef.OperationDefinition opDef,
                                 java.lang.Object serviceInstance,
                                 java.lang.Object[] parameters,
                                 java.lang.Object result)
                                 throws ServiceCallException
Callers executes this method right after they execute the targeted operation

Parameters:
context - caller context information
request - incoming message
serviceDef - called target service definition
opDef - called target operation definition
serviceInstance - called service instance
parameters - used java object parameters during operation execution
result - the result of the executed operation as java
Returns:
result of this method will be replaced by original result of the executed operation, so return the result parameter if you're not planning change anything
Throws:
ServiceCallException

beforeSent

E beforeSent(ICallerContextInfo<?> context,
             E request,
             E response,
             org.sr.common.entitydef.ServiceDefinition serviceDef,
             org.sr.common.entitydef.OperationDefinition opDef,
             java.lang.Object serviceInstance,
             java.lang.Object[] parameters)
             throws ServiceCallException
Callers executes this method right before they send the result to the caller

Parameters:
context - caller context information
request - incoming message
response - transformed response object that to be sent to the caller
serviceDef - called target service definition
opDef - called target operation definition
serviceInstance - called service instance
parameters - used java object parameters during operation execution
Returns:
result of this method will be replaced by original response of the executed operation, so return the response parameter if you're not planning change anything. Remember that response object in it's final form now which means it's probably transformed to another type rather than Java
Throws:
ServiceCallException