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    * DefaultMessageExchangeHandler.java
10   *
11   */
12  
13  package it.imolinfo.jbi4corba.jbi.component.runtime;
14  
15  import it.imolinfo.jbi4corba.Logger;
16  import it.imolinfo.jbi4corba.LoggerFactory;
17  import it.imolinfo.jbi4corba.jbi.Messages;
18  
19  import javax.jbi.messaging.Fault;
20  import javax.jbi.messaging.MessagingException;
21  import javax.jbi.messaging.NormalizedMessage;
22  
23  /**
24   *
25   * @author Sun Microsystems, Inc.
26   */
27  public class DefaultMessageExchangeHandler extends AbstractMessageExchangeHandler {
28  	
29  	/** The logger. */
30      private static final Logger LOG = 
31      	LoggerFactory.getLogger(DefaultMessageExchangeHandler.class);
32      private static final Messages MESSAGES = 
33      	Messages.getMessages(DefaultMessageExchangeHandler.class);
34  
35      
36      /** Creates a new instance of AbstractMessageExchangeHandler */
37      public DefaultMessageExchangeHandler() {
38          super();
39      }
40      
41      protected void processError(Exception ex) {
42          
43          LOG.debug("Default MessageExchange Handler processing Error");
44          ex.printStackTrace();
45          LOG.debug("Default MessageExchange Handler processed Error");
46      }
47      
48      protected void processDone() {
49          
50          LOG.debug("Default MessageExchange Handler processed DONE");
51      }
52      
53      protected  void processFault(Fault fault) {
54          
55          LOG.debug("Default MessageExchange Handler processing FAULT");
56          LOG.debug(fault.toString());
57          LOG.debug("Default MessageExchange Handler processed FAULT");
58      }
59      protected void processMessage() {
60          
61          LOG.debug("Default MessageExchange Handler processing Message");
62          NormalizedMessage inMsg = this.getMessageExchange().getMessage(IN_MESSAGE);
63          NormalizedMessage outMsg = this.getMessageExchange().getMessage(IN_MESSAGE);
64          LOG.debug("IN MESSAGE ::::::: \n" + inMsg );
65          LOG.debug("OUT MESSAGE ::::::: \n" + outMsg );
66          LOG.debug("Default MessageExchange Handler processed Message");
67      }
68      
69      protected void validateMessageExchange() throws MessagingException {
70          if ( this.getMessageExchange() == null ) {
71          	String msg=MESSAGES.getString("CRB000437_MessageExchange_Object_is_null_in_DefaultMessageExchageHandler");
72              LOG.error(msg);
73              throw new MessagingException(msg);
74  
75          }
76      }
77      
78  }