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   package it.imolinfo.jbi4corba.jbi.component;
9   
10  import it.imolinfo.jbi4corba.jbi.component.runtime.MessageExchangeHandler;
11  import it.imolinfo.jbi4corba.jbi.component.runtime.MessageExchangeHandlerFactory;
12  
13  import javax.jbi.messaging.MessageExchange;
14  
15  /**
16   * A factory for creating Jbi4EjbMessageExchangeHandler objects.
17   * 
18   * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a>
19   */
20  public class Jbi4CorbaMessageExchangeHandlerFactory implements MessageExchangeHandlerFactory {
21  
22      private Jbi4CorbaSUManager suManager = null;
23      
24      /**
25       * Instantiates a new jbi4 ejb message exchange handler factory.
26       * 
27       * @param sum the service unit manager
28       */
29      public Jbi4CorbaMessageExchangeHandlerFactory (Jbi4CorbaSUManager sum) {
30          this.suManager = sum;
31      }
32      
33      /**
34       * creates DefaultMessageExchangeHandler.
35       * 
36       * @param msgExchange the message exchange
37       * 
38       * @return the <code>Jbi4EjbMessageExchangeHandler</code> MessageExchangeHandler 
39       */
40      public MessageExchangeHandler newHandler(MessageExchange msgExchange) {
41          MessageExchangeHandler handler = new  Jbi4CorbaMessageExchangeHandler(suManager);
42          handler.setMessageExchange(msgExchange);        
43          return handler;
44      }
45  }