KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > component > common > util > MessageExchangeWrapper


1 package org.objectweb.petals.component.common.util;
2
3 import java.net.URI JavaDoc;
4 import java.util.Map JavaDoc;
5 import java.util.Set JavaDoc;
6
7 import javax.activation.DataHandler JavaDoc;
8 import javax.jbi.messaging.MessageExchange;
9 import javax.jbi.messaging.MessagingException;
10 import javax.jbi.messaging.NormalizedMessage;
11
12 import org.objectweb.petals.component.common.HandlingException;
13
14 public interface MessageExchangeWrapper extends MessageExchange {
15
16     /**
17      * Returns the initial message exchange
18      *
19      * @return
20      */

21     public MessageExchange getMessageExchange();
22
23     /**
24      * Put a Source object in the out message of the message exchange. If the
25      * out normalized message is null, it is created here.
26      *
27      * @param outContent
28      * the content to put in the out message
29      * @throws HandlingException
30      * if error occured during out message creation
31      */

32     void setOutMessageContent(final String JavaDoc outContent) throws HandlingException;
33
34     /**
35      * Get the content of the "in" message as a String
36      *
37      * @return the String represention of the "in" message content
38      * @throws HandlingException
39      * if error occured during String creation from Source or if
40      * "in" message is null
41      */

42     String JavaDoc getInMessageContent() throws HandlingException;
43
44     /**
45      * Get all the input attachments in a {@link Set}
46      *
47      * @param exchange
48      * @return
49      */

50     Set JavaDoc<DataHandler JavaDoc> getInMessageAttachments() throws HandlingException;
51
52     /**
53      * Get the message exchange Pattern
54      *
55      * @return the URI pattern. Can't be null
56      * @throws HandlingException
57      * if no message exchange pattern is set
58      */

59     URI JavaDoc getExchangePattern() throws HandlingException;
60
61     /**
62      * Get the operation name (local part of the operation QName)
63      *
64      * @return the operation name
65      * @throws HandlingException
66      * if no Operation QName is set
67      */

68     String JavaDoc getOperationName() throws HandlingException;
69
70     /**
71      * Get the endpoint name specified in the message exchange
72      *
73      * @return the endpoint name
74      * @throws HandlingException
75      * if no Endpoint is set
76      */

77     String JavaDoc getEndpointName() throws HandlingException;
78
79     /**
80      * Extract incoming NormalizedMessage from given MessageExchange
81      *
82      * @return the incoming NormalizedMessage
83      *
84      */

85     NormalizedMessage getInMessage();
86
87     /**
88      * Set the input message
89      *
90      * @param msg
91      * @throws MessagingException
92      */

93     void setInMessage(final NormalizedMessage msg) throws MessagingException;
94
95     /**
96      * Extract outgoing NormalizedMessage from given MessageExchange
97      *
98      * @return the outgoing NormalizedMessage
99      *
100      */

101     NormalizedMessage getOutMessage();
102
103     /**
104      * Set the output message
105      *
106      * @param msg
107      * @throws MessagingException
108      */

109     void setOutMessage(final NormalizedMessage msg) throws MessagingException;
110
111     /**
112      * Put a Map of attachements in the out message of the message exchange. If
113      * the out normalized message is null, it is created here.
114      *
115      * @param attachements
116      * the attachements to put in the out message
117      * @throws HandlingException
118      * if error occured during out message creation
119      */

120     void setOutMessageAttachements(Map JavaDoc<String JavaDoc, DataHandler JavaDoc> attachements)
121         throws HandlingException;
122
123     /**
124      * Set the message exchange status to DONE
125      *
126      * @throws MessagingException
127      */

128     public void setDoneStatus() throws MessagingException;
129
130     /**
131      * Test if the message status is DONE
132      *
133      * @return
134      */

135     public boolean isDoneStatus();
136
137     /**
138      * Set the message exchange status to Error
139      *
140      * @throws MessagingException
141      */

142     public void setErrorStatus() throws MessagingException;
143
144     /**
145      * Test if the message status is ERROR
146      *
147      * @return
148      */

149     public boolean isErrorStatus();
150
151     /**
152      * Set the message exchange status to ACTIVE
153      *
154      * @throws MessagingException
155      */

156     public void setActiveStatus() throws MessagingException;
157
158     /**
159      * Test if the message status is ACTIVE
160      *
161      * @return
162      */

163     public boolean isActiveStatus();
164
165     /**
166      *
167      * @return true is the message role is provider
168      */

169     public boolean isProviderRole();
170
171     /**
172      *
173      * @return true is the message role is consumer
174      */

175     public boolean isConsumerRole();
176
177     /**
178      *
179      * @return
180      */

181     public boolean isInOnlyPattern();
182
183     /**
184      *
185      * @return
186      */

187     public boolean isRobustInOnlyPattern();
188
189     /**
190      *
191      * @return
192      */

193     public boolean isInOutPattern();
194
195     /**
196      *
197      * @return
198      */

199     public boolean isInOptionalOutPattern();
200
201 }
202
Popular Tags