KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > ime > MessageExchange


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.ime;
17
18 import org.apache.axis.AxisFault;
19 import org.apache.axis.MessageContext;
20
21 import java.util.Hashtable JavaDoc;
22
23 /**
24  * Represents the boundary interface through which messages
25  * are exchanged. This interface supports both push and pull
26  * models for receiving inbound messages.
27  *
28  * @author James M Snell (jasnell@us.ibm.com)
29  * @author Ray Chun (rchun@sonicsoftware.com)
30  */

31 public interface MessageExchange {
32
33     /**
34      * Send an outbound message. (Impl's of this method
35      * need to create a new MessageExchangeCorrelator and
36      * put it into the MessageContext if one does not already
37      * exist.)
38      * @param context The Axis MessageContext being sent
39      * @return MessageExchangeCorrelator The correlator for the sent MessageContext
40      * @throws AxisFault
41      */

42     public MessageExchangeCorrelator send(
43             MessageContext context)
44             throws AxisFault;
45
46     /**
47      * Send an outbound message. (Impl's of this method
48      * need to create a new MessageExchangeCorrelator and
49      * put it into the MessageContext if one does not already
50      * exist.)
51      * @param MessageContext The Axis MessageContext being sent
52      * @param MessageContextListener The listener to which responses, faults, and status updates should be delivered
53      * @return MessageExchangeCorrelator The correlator for the sent MessageContext
54      * @throws AxisFault
55      */

56     public MessageExchangeCorrelator send(
57             MessageContext context,
58             MessageExchangeEventListener listener)
59             throws AxisFault;
60
61     /**
62      * Waits indefinitely for a message to be received
63      * (blocking)
64      * @return MessageContext The received MessageContext
65      * @throws AxisFault
66      */

67     public MessageContext receive()
68             throws AxisFault;
69
70     /**
71      * Waits the specified amount of time for a message to
72      * be received
73      * (blocking)
74      * @param long The amount of time (ms) to wait
75      * @return MessageContext The received MessageContext
76      * @throws AxisFault
77      */

78     public MessageContext receive(
79             long timeout)
80             throws AxisFault;
81
82     /**
83      * Waits indefinitely for a message matching the
84      * specified correlator
85      * (blocking)
86      * @param MessageExchangeCorrelator
87      * @return MessageContext
88      * @throws AxisFault
89      */

90     public MessageContext receive(
91             MessageExchangeCorrelator correlator)
92             throws AxisFault;
93
94     /**
95      * Waits the specified amount of time for a message matching the
96      * specified correlator
97      * (blocking)
98      * @param MessageExchangeCorrelator
99      * @param long timeout
100      * @returns MessageContext
101      * @throws AxisFault
102      */

103     public MessageContext receive(
104             MessageExchangeCorrelator correlator,
105             long timeout)
106             throws AxisFault;
107
108     /**
109      * Registers a listener for receiving messages
110      * (nonblocking)
111      * @param MessageContextListener
112      * @throws AxisFault
113      */

114     public void receive(
115             MessageExchangeEventListener listener)
116             throws AxisFault;
117
118     /**
119      * Registers a listener for receiving messages
120      * (nonblocking)
121      * @param MessageExchangeCorrelator
122      * @param MessageContextListener
123      * @throws AxisFault
124      */

125     public void receive(
126             MessageExchangeCorrelator correlator,
127             MessageExchangeEventListener listener)
128             throws AxisFault;
129
130     /**
131      * Synchronized send and receive
132      * @param MessageContext The MessageContext to send
133      * @return MessageContext The received MessageContext (not guaranteed to be the same object instance as the sent MessageContext)
134      * @throws AxisFault
135      */

136     public MessageContext sendAndReceive(
137             MessageContext context)
138             throws AxisFault;
139
140     /**
141      * Synchronized send and receive with timeout
142      * @param MessageContext The MessageContext to send
143      * @param long The length of time (ms) to wait for a response. If a response is not received within the specified amount of time, an AxisFault indicating timeout must be thrown
144      * @return MessageContext The received MessageContext (not guaranteed to be the same object instance as the sent MessageContext)
145      * @throws AxisFault
146      */

147     public MessageContext sendAndReceive(
148             MessageContext context,
149             long timeout)
150             throws AxisFault;
151
152     public void setMessageExchangeEventListener(
153             MessageExchangeEventListener listener);
154         
155     public MessageExchangeEventListener getMessageExchangeEventListener();
156
157     /**
158      * @param String The id of the property
159      * @param Object The value of the Option
160      */

161     public void setOption(
162             String JavaDoc OptionId,
163             Object JavaDoc OptionValue);
164
165     /**
166      * @param String The id of the Option
167      * @return Object The value of the Option
168      */

169     public Object JavaDoc getOption(
170             String JavaDoc OptionId);
171
172     /**
173      * @param String The id of the Option
174      * @param Object The default value of the Option
175      * @return Object The value of the Option
176      */

177     public Object JavaDoc getOption(
178             String JavaDoc OptionId,
179             Object JavaDoc defaultValue);
180
181     /**
182      * @return java.lang.Hashtable The collection of properties
183      */

184     public Hashtable JavaDoc getOptions();
185
186     /**
187      * @param java.lang.Hashtable The collection of properties
188      */

189     public void setOptions(Hashtable JavaDoc options);
190
191     public void clearOptions();
192
193 }
194
Popular Tags