1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package it.imolinfo.jbi4ejb.jbi.component.runtime;
31
32 import it.imolinfo.jbi4ejb.Logger;
33 import it.imolinfo.jbi4ejb.LoggerFactory;
34 import it.imolinfo.jbi4ejb.jbi.Messages;
35
36 import javax.jbi.messaging.Fault;
37 import javax.jbi.messaging.MessageExchange;
38 import javax.jbi.messaging.MessagingException;
39 import javax.jbi.messaging.NormalizedMessage;
40
41
42
43
44
45 public class DefaultMessageExchangeHandler extends AbstractMessageExchangeHandler {
46
47 private static final Logger LOG = LoggerFactory.getLogger( DefaultMessageExchangeHandler.class);
48 private static final Messages MESSAGES = Messages.getMessages( DefaultMessageExchangeHandler.class);
49
50 public DefaultMessageExchangeHandler() {
51 super();
52 }
53
54 protected void processError(Exception ex) {
55
56 System.out.println("Default MessageExchange Handler processing Error");
57 ex.printStackTrace();
58 System.out.println("Default MessageExchange Handler processed Error");
59 }
60
61 protected void processDone() {
62
63 System.out.println("Default MessageExchange Handler processed DONE");
64 }
65
66 protected void processFault(Fault fault) {
67
68 System.out.println("Default MessageExchange Handler processing FAULT");
69 System.out.println(fault.toString());
70 System.out.println("Default MessageExchange Handler processed FAULT");
71 }
72
73 protected void processMessage() {
74
75 System.out.println("Default MessageExchange Handler processing Message");
76 NormalizedMessage inMsg = this.getMessageExchange().getMessage(IN_MESSAGE);
77 NormalizedMessage outMsg = this.getMessageExchange().getMessage(IN_MESSAGE);
78 System.out.println("IN MESSAGE ::::::: \n" + inMsg );
79 System.out.println("OUT MESSAGE ::::::: \n" + outMsg );
80 System.out.println("Default MessageExchange Handler processed Message");
81 }
82
83 protected void validateMessageExchange() throws MessagingException {
84 MessageExchange msgExchange = this.getMessageExchange();
85
86 if ( this.getMessageExchange() == null ) {
87
88 String msg=MESSAGES.getString("EJB000215_MessageExchange_Object_null_in_DefaultMessageExchageHandler");
89 LOG.error(msg);
90 throw new MessagingException(msg);
91
92
93 }
94 }
95
96 }