01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id: ProviderProcessor.java 6901 2007-04-18 18:54:24Z tvolle $
23: */
24: package com.bostechcorp.cbesb.runtime.component.tcpip.processors;
25:
26: import javax.jbi.messaging.MessageExchange;
27: import javax.jbi.messaging.NormalizedMessage;
28: import javax.xml.namespace.QName;
29:
30: import org.apache.commons.logging.Log;
31: import org.apache.commons.logging.LogFactory;
32:
33: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbProviderProcessor;
34: import com.bostechcorp.cbesb.runtime.component.tcpip.TcpipEndpoint;
35:
36: public class ProviderProcessor extends CbProviderProcessor {
37:
38: protected final transient Log logger = LogFactory
39: .getLog(getClass());
40:
41: private TcpipEndpoint endpoint;
42:
43: public ProviderProcessor(TcpipEndpoint endpoint) {
44: super (endpoint);
45: this .endpoint = endpoint;
46: }
47:
48: @Override
49: public void processInMessage(QName service, QName operation,
50: NormalizedMessage in, MessageExchange exchange)
51: throws Exception {
52:
53: logger.debug("Tcpip provider processInMessage");
54: endpoint.getSendQueue().put(exchange);
55: Object rtn = endpoint.getReturnQueue().take();
56: logger.debug("Tcpip provider return from handler");
57: if (rtn instanceof Exception)
58: throw (Exception) rtn;
59:
60: }
61:
62: /*
63: * (non-Javadoc)
64: *
65: * @see com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.BaseProviderProcessor#processInOutMessage(javax.xml.namespace.QName,
66: * javax.xml.namespace.QName, javax.jbi.messaging.NormalizedMessage,
67: * javax.jbi.messaging.NormalizedMessage, boolean)
68: */
69: public boolean processInOutMessage(QName service, QName operation,
70: NormalizedMessage in, NormalizedMessage out,
71: boolean optionalOut, MessageExchange exchange)
72: throws Exception {
73:
74: logger.debug("Tcpip provider processInOutMessage");
75: endpoint.getSendQueue().put(exchange);
76: Object rtn = endpoint.getReturnQueue().take();
77: logger.debug("Tcpip provider return from handler");
78: if (rtn instanceof Exception)
79: throw (Exception) rtn;
80: return true;
81: }
82: }
|