org.ow2.petals.component.framework.api
Class Interceptor

java.lang.Object
  extended by org.ow2.petals.component.framework.api.Interceptor

public abstract class Interceptor
extends Object

An abstract class for JBI message interceptor.

Since:
1.0
Author:
chamerling - EBM WebSourcing

Field Summary
protected  boolean active
          Interceptor is always activated ie it is activated for all service units on all phases (send and accept)?
protected  PetalsComponent component
          The JBI component of the interceptor (to enable access to all the component context)
protected  Map<String,String> componentParameters
          The interceptor attributes (defined in the component descriptor).
protected  Logger logger
          The component logger
protected  String name
          The name of the interceptor (defined in the component descriptor).
 
Constructor Summary
Interceptor()
          Creates a new instance of Interceptor
 
Method Summary
 Map<String,String> getComponentParameters()
           
 String getName()
           
abstract  void handleMessageAccept(Exchange exchange, org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides, Map<String,String> additionalParameters)
          Method called before the provider of service receive its request.
abstract  void handleMessageAcceptResponse(Exchange exchange, org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides, Map<String,String> additionalParameters)
          Method called before the provider of service send its response.
abstract  void handleMessageSent(Exchange exchange, org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes, Map<String,String> additionalParameters)
          Method called before the consumer of service send a request.
abstract  void handleMessageSentResponse(Exchange exchange, org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes, Map<String,String> additionalParameters)
          Method called before the consumer of service receive its response.
 void init(PetalsComponent component, String name, boolean active, Map<String,String> componentParameters, Logger logger)
          Initialize the interceptor from its parameters.
 boolean isActive()
           
protected  void onInit()
          Initialization callback.
 void setActive(boolean active)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected PetalsComponent component
The JBI component of the interceptor (to enable access to all the component context)


name

protected String name
The name of the interceptor (defined in the component descriptor). This name will be used in the service units as reference;


componentParameters

protected Map<String,String> componentParameters
The interceptor attributes (defined in the component descriptor). These parameters are the initial ones and are not mutable.


active

protected boolean active
Interceptor is always activated ie it is activated for all service units on all phases (send and accept)?


logger

protected Logger logger
The component logger

Constructor Detail

Interceptor

public Interceptor()
Creates a new instance of Interceptor

Method Detail

init

public final void init(PetalsComponent component,
                       String name,
                       boolean active,
                       Map<String,String> componentParameters,
                       Logger logger)
                throws PEtALSCDKException
Initialize the interceptor from its parameters. The parameters are created from the interceptor parameters defined in the JBI descriptor. The interceptor developer must implement this method if he want to initialize its interceptor from the defined parameters.

Parameters:
parameters - could not be null. The parameters are loaded by the CDK. If no parameter has been found, the map is empty but not null.
Throws:
PEtALSCDKException

onInit

protected void onInit()
               throws Exception
Initialization callback. The developer can do extra interceptor configuration here (create configuration objects from parameters, register MBeans...)

Throws:
Exception - an exception can be raised by the interceptor developer. If an exception is raised, the interceptor will not be available in the component.

handleMessageSent

public abstract void handleMessageSent(Exchange exchange,
                                       org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes,
                                       Map<String,String> additionalParameters)
Method called before the consumer of service send a request.

Parameters:
exchange -
sonsumes - The Consumes configuration
additionalParameters - the parameters defined in the SU for this interceptor. The user can use this map to retrieve the parameters defined in the Consume or Provide extensions.

handleMessageSentResponse

public abstract void handleMessageSentResponse(Exchange exchange,
                                               org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes,
                                               Map<String,String> additionalParameters)
Method called before the consumer of service receive its response.

Parameters:
exchange -
consumes - The Consumes configuration
additionalParameters - the parameters defined in the SU for this interceptor. The user can use this map to retrieve the parameters defined in the Consume or Provide extensions.

handleMessageAccept

public abstract void handleMessageAccept(Exchange exchange,
                                         org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides,
                                         Map<String,String> additionalParameters)
Method called before the provider of service receive its request.

Parameters:
exchange -
provides - The Provides configuration
additionalParameters - the parameters defined in the SU for this interceptor. The user can use this map to retrieve the parameters defined in the Consume or Provide extensions.

handleMessageAcceptResponse

public abstract void handleMessageAcceptResponse(Exchange exchange,
                                                 org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides,
                                                 Map<String,String> additionalParameters)
Method called before the provider of service send its response.

Parameters:
exchange -
provides - The Provides configuration
additionalParameters - the parameters defined in the SU for this interceptor. The user can use this map to retrieve the parameters defined in the Consume or Provide extensions.

getName

public final String getName()
Returns:
the name

isActive

public boolean isActive()
Returns:
the active

setActive

public void setActive(boolean active)
Parameters:
active - the active to set

getComponentParameters

public Map<String,String> getComponentParameters()
Returns:
the parameters


Copyright © 2005-2012 Petals Link (EBM Websourcing). All Rights Reserved.