View Javadoc

1   /*
2    * The contents of this file are subject to the terms
3    * of the Common Development and Distribution License
4    * (the "License").  You may not use this file except
5    * in compliance with the License.
6    *
7    * You can obtain a copy of the license at
8    * https://open-esb.dev.java.net/public/CDDLv1.0.html.
9    * See the License for the specific language governing
10   * permissions and limitations under the License.
11   *
12   * When distributing Covered Code, include this CDDL
13   * HEADER in each file and include the License file at
14   * https://open-esb.dev.java.net/public/CDDLv1.0.html.
15   * If applicable add the following below this CDDL HEADER,
16   * with the fields enclosed by brackets "[]" replaced with
17   * your own identifying information: Portions Copyright
18   * [year] [name of copyright owner]
19   */
20  
21  /*
22   * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
23   */
24  
25  /*
26   * MessageExchangeHandlerFactory.java
27   *
28   */
29  
30  package it.imolinfo.jbi4ejb.jbi.component.runtime;
31  
32  import javax.jbi.messaging.MessageExchange;
33  
34  /**
35   * factory interface to create the message exchange handlers.
36   * @author Sun Microsystems, Inc.
37   */
38  public interface MessageExchangeHandlerFactory  {
39      
40      /**
41       * creates new MessageExchangeHandler
42       * @param msgExchange MessageExchange Object for which the handler will be created
43       * @return MessageExchangeHandler for the MessageExchange object
44       */
45      MessageExchangeHandler newHandler(MessageExchange msgExchange);
46      
47      /**
48       * Default MessageExchangeHandlerFactory implementation that returns the
49       * DefaultMessageExchangeHandler for MessageExchange object
50       */
51      public static class DefaultMessageExchangeHandlerFactory implements MessageExchangeHandlerFactory {
52          
53          /**
54           * creates DefaultMessageExchangeHandler
55           * @param msgExchange
56           * @return
57           */
58          public MessageExchangeHandler newHandler(MessageExchange msgExchange) {
59              MessageExchangeHandler handler = new  DefaultMessageExchangeHandler();
60              handler.setMessageExchange(msgExchange);
61              return handler;
62          }
63      }
64  }