View Javadoc

1    /****************************************************************************
2    * Copyright (c) 2005, 2006, 2007, 2008, 2009 Imola Informatica.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the LGPL License v2.1
5    * which accompanies this distribution, and is available at
6    * http://www.gnu.org/licenses/lgpl.html
7    ****************************************************************************/
8   /*
9    * MessageExchangeHandlerFactory.java
10   *
11   */
12  
13  package it.imolinfo.jbi4corba.jbi.component.runtime;
14  
15  import javax.jbi.messaging.MessageExchange;
16  
17  /**
18   * Factory interface to create the message exchange handlers.
19   * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a>
20   */
21  public interface MessageExchangeHandlerFactory  {
22      
23      /**
24       * creates new MessageExchangeHandler
25       * @param msgExchange MessageExchange Object for which the handler will be created
26       * @return MessageExchangeHandler for the MessageExchange object
27       */
28      MessageExchangeHandler newHandler(MessageExchange msgExchange);
29      
30      /**
31       * Default MessageExchangeHandlerFactory implementation that returns the
32       * DefaultMessageExchangeHandler for MessageExchange object
33       */
34      public static class DefaultMessageExchangeHandlerFactory implements MessageExchangeHandlerFactory {
35          
36          /**
37           * creates DefaultMessageExchangeHandler
38           * @param msgExchange
39           * @return
40           */
41          public MessageExchangeHandler newHandler(MessageExchange msgExchange) {
42              MessageExchangeHandler handler = new  DefaultMessageExchangeHandler();
43              handler.setMessageExchange(msgExchange);
44              return handler;
45          }
46      }
47  }