01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2007 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: ITcpipHandler.java 6188 2007-03-21 21:20:31Z tvolle $
23: */
24: package com.bostechcorp.cbesb.runtime.ccsl.lib;
25:
26: import javax.jbi.messaging.MessageExchange;
27:
28: /*
29: * A TCPIP protocol handler must implement this interface.
30: */
31: public interface ITcpipHandler {
32:
33: /* Initialize and receive the component's context object.
34: */
35: public void init(ITcpipContext context);
36:
37: /*
38: * Return a description used for browsing in the UI.
39: */
40: public String getDescription();
41:
42: /*
43: * In consumer mode, The component will call this method when socket
44: * data is available.
45: */
46: public int gotReceiveData(byte[] bytes) throws Exception;
47:
48: /*
49: * In consumer mode, the container will call this when a socket
50: * timeout occurs.
51: */
52: public void gotReceiveTimeout() throws Exception;
53:
54: /*
55: * In consumer mode, the component will call this method when
56: * a socket error occurs. Usually this indicates the component
57: * is shutting down or a peer disconnected.
58: */
59: public void gotSocketError(Exception e) throws Exception;
60:
61: /*
62: * In provider mode, the component calls this to process an outbound
63: * message exchange. Only one thread at a time will run
64: * these methods.
65: */
66:
67: /*
68: * These are the default byte array based callbacks. For an in-out exchange,
69: * the out message bytes are returned.
70: */
71: public void processInOnlyBytes(byte[] bytes) throws Exception;
72:
73: public byte[] processInOutBytes(byte[] bytes) throws Exception;
74:
75: /*
76: * These are the MessageExchange based calls. The handler enables these
77: * callbacks by calling setExchangeBasedProvider(true) on the tcpip context.
78: * For an in-out exchange, the out message should be populated before returning.
79: */
80: public void processInOnlyExchange(MessageExchange e)
81: throws Exception;
82:
83: public void processInOutExchange(MessageExchange e)
84: throws Exception;
85: }
|