org.ow2.petals.component.framework.listener
Class AbstractListener

java.lang.Object
  extended by org.ow2.petals.component.framework.listener.AbstractListener
Direct Known Subclasses:
AbstractExternalListener, AbstractJBIListener

public abstract class AbstractListener
extends java.lang.Object

The abstract methods for a CDK listener. Both external and JBI listener extend it.

Author:
chamerling - EBM WebSourcing, ofabre - EBM WebSourcing, alouis - EBM WebSourcing

Field Summary
protected  AbstractComponent component
          The JBI component itself
protected  javax.jbi.messaging.MessageExchangeFactory factory
          The messageExchange factory used to create MessageExchanges
protected  MessageInterceptorProcessor messageInterceptorProcessor
          The message interceptor processor; Each listener have its own interceptor processor in order to get better performances.
 
Constructor Summary
AbstractListener()
          Creates a new instance of AbstractListener
 
Method Summary
 org.ow2.petals.component.framework.api.message.Exchange createConsumeExchange(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
          Create a message exchange with all the information set in the specified CONSUME
- address (interface, service, endpoint)
- MEP
- operation
- PEtALS exchange' meta-data (org.objectweb.petals.xxx)
 org.ow2.petals.component.framework.api.message.Exchange createConsumeExchange(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes, org.ow2.petals.component.framework.api.Message.MEPConstants mep)
          Create a message exchange with all the information set in the specified CONSUME, with the given exchange pattern
- address (interface, service, endpoint)
- operation
- PEtALS exchange' meta-data (org.objectweb.petals.xxx)
 org.ow2.petals.component.framework.api.message.Exchange createExchange(org.ow2.petals.component.framework.api.Message.MEPConstants mep)
          Create an exchange implementation matching the given pattern.
 AbstractComponent getComponent()
          Get the component.
 javax.jbi.component.ComponentContext getComponentContext()
          Deprecated. 
 org.ow2.petals.component.framework.jbidescriptor.generated.Consumes getConsumes()
           
 javax.transaction.Transaction getCurrentTransaction()
          Return the current Transaction.
 org.ow2.petals.component.framework.api.configuration.ConfigurationExtensions getExtensions()
          Get the service extensions.
 java.lang.String getInstallRoot()
           
 java.util.logging.Logger getLogger()
           
 MessageInterceptorProcessor getMessageInterceptorProcessor()
           
 org.ow2.petals.component.framework.jbidescriptor.generated.Provides getProvides()
           
 void init()
          A convenience method which can be overridden so that there's no need to call super.init().
 void init(AbstractComponent component)
          Initialize the listener.
protected  org.ow2.petals.component.framework.api.Message.MEPConstants retrievePattern(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
          Retrieve the MEP from the consumer node extensions.
 void send(org.ow2.petals.component.framework.api.message.Exchange exchange)
          Send a message to the endpoint specified in the MessageExchange in an asynchronous way.
Process MessageExchange interceptors before sending message.
 void sendAsync(org.ow2.petals.component.framework.api.message.Exchange exchange, AsyncContext asyncContext)
          Send a message to the endpoint specified in the MessageExchange in an asynchronous way.
 boolean sendSync(org.ow2.petals.component.framework.api.message.Exchange exchange)
          Call sendSync(MessageExchage exchange, long timeoutMS) with a timeout value found in provides or consumes extensions or "0" if not found
 boolean sendSync(org.ow2.petals.component.framework.api.message.Exchange exchange, long timeoutMS)
          Send a message to the endpoint specified in the MessageExchange in an synchronous way.
Process MessageExchange interceptors before sending message.
 void setConsumes(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
           
 void setCurrentTransaction(javax.transaction.Transaction transaction)
           
 void setExtensions(org.ow2.petals.component.framework.api.configuration.ConfigurationExtensions extensions)
           
 void setProvides(org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides)
          Set Provides section
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected AbstractComponent component
The JBI component itself


factory

protected javax.jbi.messaging.MessageExchangeFactory factory
The messageExchange factory used to create MessageExchanges


messageInterceptorProcessor

protected MessageInterceptorProcessor messageInterceptorProcessor
The message interceptor processor; Each listener have its own interceptor processor in order to get better performances.

Constructor Detail

AbstractListener

public AbstractListener()
Creates a new instance of AbstractListener

Method Detail

createConsumeExchange

public org.ow2.petals.component.framework.api.message.Exchange createConsumeExchange(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
                                                                              throws javax.jbi.messaging.MessagingException,
                                                                                     org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Create a message exchange with all the information set in the specified CONSUME
- address (interface, service, endpoint)
- MEP
- operation
- PEtALS exchange' meta-data (org.objectweb.petals.xxx)

Returns:
a message exchange set with Consumes attributes
Throws:
javax.jbi.messaging.MessagingException - The message exchange can't be created or no pattern specified in extensions
org.ow2.petals.component.framework.api.exception.PEtALSCDKException - The current Transaction has failed to return its status

createConsumeExchange

public org.ow2.petals.component.framework.api.message.Exchange createConsumeExchange(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes,
                                                                                     org.ow2.petals.component.framework.api.Message.MEPConstants mep)
                                                                              throws javax.jbi.messaging.MessagingException,
                                                                                     org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Create a message exchange with all the information set in the specified CONSUME, with the given exchange pattern
- address (interface, service, endpoint)
- operation
- PEtALS exchange' meta-data (org.objectweb.petals.xxx)

Returns:
a message exchange set with Consumes attributes
Throws:
javax.jbi.messaging.MessagingException - The message exchange can't be created or no pattern specified in extensions
org.ow2.petals.component.framework.api.exception.PEtALSCDKException - The current Transaction has failed to return its status

createExchange

public org.ow2.petals.component.framework.api.message.Exchange createExchange(org.ow2.petals.component.framework.api.Message.MEPConstants mep)
                                                                       throws javax.jbi.messaging.MessagingException,
                                                                              org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Create an exchange implementation matching the given pattern.

Parameters:
mep - a specific MEP pattern
Returns:
an exchange implementation matching the given pattern
Throws:
javax.jbi.messaging.MessagingException - The message exchange can't be created or no pattern specified in extensions
org.ow2.petals.component.framework.api.exception.PEtALSCDKException - The current Transaction has failed to return its status

getComponent

public AbstractComponent getComponent()
Get the component.

Returns:

getComponentContext

@Deprecated
public javax.jbi.component.ComponentContext getComponentContext()
Deprecated. 

The direct usage of the Component context is not recommended in the CDK.

Returns:

getConsumes

public org.ow2.petals.component.framework.jbidescriptor.generated.Consumes getConsumes()

getCurrentTransaction

public javax.transaction.Transaction getCurrentTransaction()
                                                    throws org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Return the current Transaction.

Returns:
The current Transaction or null if no Transaction Manager is implemented by the JBI container
Throws:
javax.transaction.SystemException
javax.transaction.NotSupportedException
org.ow2.petals.component.framework.api.exception.PEtALSCDKException

getExtensions

public org.ow2.petals.component.framework.api.configuration.ConfigurationExtensions getExtensions()
Get the service extensions.

Returns:
Extensions, can be null if no extensions found

getInstallRoot

public java.lang.String getInstallRoot()

getLogger

public java.util.logging.Logger getLogger()
Returns:

getMessageInterceptorProcessor

public MessageInterceptorProcessor getMessageInterceptorProcessor()
Returns:
the messageInterceptorProcessor

getProvides

public org.ow2.petals.component.framework.jbidescriptor.generated.Provides getProvides()

init

public void init()
A convenience method which can be overridden so that there's no need to call super.init(). This method is called after setting of all Listener attributes


init

public final void init(AbstractComponent component)
Initialize the listener.

Parameters:
component -

send

public void send(org.ow2.petals.component.framework.api.message.Exchange exchange)
          throws javax.jbi.messaging.MessagingException
Send a message to the endpoint specified in the MessageExchange in an asynchronous way.
Process MessageExchange interceptors before sending message.

Parameters:
exchange - message exchange to send; must be non-null
Throws:
javax.jbi.messaging.MessagingException - if the address has no endpoint associated to it, or if an error occurs while sending the message through the container
Since:
2.0 operation and metadata are now set with createConsumeExchange()

sendAsync

public void sendAsync(org.ow2.petals.component.framework.api.message.Exchange exchange,
                      AsyncContext asyncContext)
               throws javax.jbi.messaging.MessagingException
Send a message to the endpoint specified in the MessageExchange in an asynchronous way.

Parameters:
exchange - message exchange to send; must be non-null
Throws:
javax.jbi.messaging.MessagingException - if the address has no endpoint associated to it, or if an error occurs while sending the message through the container
Since:
2.0 operation and metadata are now set with createConsumeExchange()

sendSync

public boolean sendSync(org.ow2.petals.component.framework.api.message.Exchange exchange)
                 throws javax.jbi.messaging.MessagingException
Call sendSync(MessageExchage exchange, long timeoutMS) with a timeout value found in provides or consumes extensions or "0" if not found

Throws:
javax.jbi.messaging.MessagingException
Since:
2.0 operation and metadata are now set with createConsumeExchange()

sendSync

public boolean sendSync(org.ow2.petals.component.framework.api.message.Exchange exchange,
                        long timeoutMS)
                 throws javax.jbi.messaging.MessagingException
Send a message to the endpoint specified in the MessageExchange in an synchronous way.
Process MessageExchange interceptors before sending message.

Parameters:
exchange - message exchange to send; must be non-null
timeoutMS - timeout period, in milliseconds (0 means no timeout); must be greater than or equal to zero
Returns:
true if the message has been sent (if a timeout occurs, return false)
Throws:
javax.jbi.messaging.MessagingException - if the address has no endpoint associated to it, or if an error occurs while sending the message through the container
Since:
2.0 operation and metadata are now set with createConsumeExchange()

setConsumes

public final void setConsumes(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
Parameters:
consumes - the consumes to set

setCurrentTransaction

public final void setCurrentTransaction(javax.transaction.Transaction transaction)
Parameters:
transaction -

setExtensions

public final void setExtensions(org.ow2.petals.component.framework.api.configuration.ConfigurationExtensions extensions)
Parameters:
consumes - the consumes to set

setProvides

public final void setProvides(org.ow2.petals.component.framework.jbidescriptor.generated.Provides provides)
Set Provides section

Parameters:
provides - the provides to set

retrievePattern

protected final org.ow2.petals.component.framework.api.Message.MEPConstants retrievePattern(org.ow2.petals.component.framework.jbidescriptor.generated.Consumes consumes)
                                                                                     throws javax.jbi.messaging.MessagingException
Retrieve the MEP from the consumer node extensions.

Parameters:
consumes - The consumer node of the SU JBI descriptor.
Returns:
MEP specified in extensions, or null if no MEP pattern specified.
Throws:
javax.jbi.messaging.MessagingException - MEP pattern specified in consumes extension is not valid.


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