KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > daemon > messageservice > Message


1 /*
2  * MessageQueueClient: The message queue client library
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * Message.java
20  */

21
22 // package path
23
package com.rift.coad.daemon.messageservice;
24
25 // java imports
26
import java.io.Serializable JavaDoc;
27 import java.util.Date JavaDoc;
28 import java.util.Enumeration JavaDoc;
29 import java.util.List JavaDoc;
30
31 /**
32  * The definition of the message object.
33  *
34  * @author Brett Chaldecott
35  */

36 public interface Message extends Serializable JavaDoc {
37     
38     /**
39      * A message will get delivered to a point defined by a JNDI URL.
40      */

41     public final static int POINT_TO_POINT = 1;
42     
43     /**
44      * A message will get delivered to the first available service with a
45      * matching service name.
46      */

47     public final static int POINT_TO_SERVICE = 2;
48     
49     /**
50      * A message will get delivered to all services within a coadunation cluster
51      * that match the service name.
52      */

53     public final static int POINT_TO_MULTI_SERVICE = 3;
54     
55     /**
56      * This state flag indicates that a message is undelivered.
57      */

58     public final static int UNDELIVERED = 1;
59     
60     /**
61      * The message has been delivered to its destination.
62      */

63     public final static int DELIVERED = 2;
64     
65     /**
66      * The message could not be delivered to its destination.
67      */

68     public final static int UNDELIVERABLE = 3;
69     
70     
71     /**
72      * A warning
73      */

74     public final static int WARN = 1;
75     
76     
77     /**
78      * An error.
79      */

80     public final static int ERROR = 2;
81     
82     
83     /**
84      * A critical error.
85      */

86     public final static int CRITICAL = 3;
87     /**
88      * This method returns the id of this message object.
89      *
90      * @return The id of the message object.
91      */

92     public String JavaDoc getMessageId();
93     
94     
95     /**
96      * This method returns the date this message was created.
97      *
98      * @return The date message was created.
99      */

100     public Date JavaDoc getCreated();
101     
102     
103     /**
104      * This is the number of retries this message has had.
105      *
106      * @return The number of retries performed by this message.
107      */

108     public int getRetries();
109     
110     
111     /**
112      * This method increments the retry count on this object.
113      */

114     public void incrementRetries();
115     
116     
117     /**
118      * This method will return the last processed date.
119      */

120     public Date JavaDoc getProcessedDate();
121     
122     
123     /**
124      * This method sets the processed date.
125      *
126      * @param processedDate The processed date of the message.
127      */

128     public void setProcessedDate(Date JavaDoc processedDate);
129     
130     
131     /**
132      * This method returns the creator of this message.
133      */

134     public String JavaDoc getMessageCreater();
135     
136     
137     /**
138      * This method returns the ID of the session that created this message.
139      *
140      * @return The string containing the id of the session that created this
141      * message.
142      */

143     public String JavaDoc getSessionId();
144     
145     
146     /**
147      * This method returns the list of user principals assigned to this message.
148      *
149      * @return The list of user principals assigned to this message.
150      */

151     public List JavaDoc getMessagePrincipals();
152     
153     
154     /**
155      * This method returns the type of message that this object represents.
156      *
157      * @return The type of object being wrapped.
158      */

159     public int getMessageType();
160     
161     
162     /**
163      * This method sets the type of message that this object represents.
164      *
165      * @param messageType The type of object being wrapped.
166      */

167     public void setMessageType(int messageType);
168     
169     /**
170      * This method will return the URL string for this message if this is a
171      * point to point message.
172      *
173      * @return The string containing the Target URL.
174      * @exception MessageServiceException
175      * @exception InvalidMessageType
176      */

177     public String JavaDoc getTarget() throws MessageServiceException,
178             InvalidMessageType;
179     
180     
181     /**
182      * This method sets the target of the message.
183      *
184      * @param target The string containing the Target URL.
185      * @exception MessageServiceException
186      * @exception InvalidMessageType
187      */

188     public void setTarget(String JavaDoc target) throws MessageServiceException,
189             InvalidMessageType;
190     
191     
192     /**
193      * This method returns the list of services.
194      *
195      * @return The string array list of services.
196      * @exception MessageServiceException
197      * @exception InvalidMessageType
198      */

199     public String JavaDoc[] getServices() throws MessageServiceException,
200             InvalidMessageType;
201     
202     
203     /**
204      * This method returns the list of services this message targeted at.
205      *
206      * @param services The list of services.
207      * @exception MessageServiceException
208      * @exception InvalidMessageType
209      */

210     public void setServices(String JavaDoc[] services) throws MessageServiceException,
211             InvalidMessageType;
212     
213     
214     /**
215      * This method returns the from URL of a message.
216      *
217      * @return The string containing the from URL.
218      * @exception MessageServiceException
219      */

220     public String JavaDoc getFrom() throws MessageServiceException;
221     
222     
223     /**
224      * This method returns the from address of the message.
225      *
226      * @return The from address of the message.
227      * @exception MessageServiceException
228      */

229     public void setFrom(String JavaDoc from) throws MessageServiceException;
230     
231     
232     /**
233      * This method returns the reply to URL, it can be different from the from
234      * URL.
235      *
236      * @return The string containing the from URL.
237      * @exception MessageServiceException
238      */

239     public String JavaDoc getReplyTo() throws MessageServiceException;
240     
241     
242     /**
243      * This method returns the reply to URL, it can be different from the from
244      * URL.
245      *
246      * @return The string containing the from URL.
247      * @exception MessageServiceException
248      */

249     public void setReplyTo(String JavaDoc replyTo) throws MessageServiceException;
250     
251     
252     /**
253      * This method gets the target named queue.
254      *
255      * @return The string containing the Queue name.
256      * @exception MessageServiceException
257      */

258     public String JavaDoc getTargetNamedQueue() throws MessageServiceException;
259     
260     
261     /**
262      * This method sets the target named queue.
263      *
264      * @param name The string containing the Queue name.
265      * @exception MessageServiceException
266      */

267     public void setTargetNamedQueue(String JavaDoc name) throws MessageServiceException;
268     
269     
270     /**
271      * This will only be set if the reply service is not a daemon, but an
272      * external process.
273      *
274      * @return The string containing the Queue name.
275      * @exception MessageServiceException
276      */

277     public String JavaDoc getReplyNamedQueue() throws MessageServiceException;
278     
279     
280     /**
281      * This will only be set if the reply service is not a daemon, but an
282      * external process.
283      *
284      * @param name The string containing the Queue name.
285      * @exception MessageServiceException
286      */

287     public void setReplyNamedQueue(String JavaDoc name) throws MessageServiceException;
288     
289     
290     /**
291      * This method returns the value of the reply flag. TRUE if it should reply
292      * FALSE if it should not.
293      *
294      * @return TRUE if this message must reply, FALSE if not.
295      * @exception MessageServiceException
296      */

297     public boolean getReply() throws MessageServiceException;
298     
299     
300     /**
301      * This method sets the reply flag.
302      *
303      * @param value TRUE if a reply is required, FALSE if not.
304      * @exception MessageServiceException
305      */

306     public void setReply(boolean value) throws MessageServiceException;
307     
308     
309     /**
310      * This message returns the priority of this message.
311      *
312      * @return The int indicating the priority of this message.
313      * @exception MessageServiceException
314      */

315     public int getPriority();
316     
317     
318     /**
319      * This method sets the priority of the message.
320      *
321      * @param priority The priority of the message.
322      * @exception MessageServiceException
323      */

324     public void setPriority(int priority) throws MessageServiceException;
325     
326     
327     /**
328      * This method sets the correlation id for this message. It is the external
329      * identifier for this message.
330      *
331      * @param id The id that will be used as the correlation id.
332      * @exception MessageServiceException
333      */

334     public void setCorrelationId(String JavaDoc id) throws MessageServiceException;
335     
336     
337     /**
338      * The external correlation id for this message.
339      *
340      * @return The string containing the correllation ID.
341      * @exception MessageServiceException
342      */

343     public String JavaDoc getCorrelationId() throws MessageServiceException;
344     
345     
346     /**
347      * This clears the body of the message.
348      *
349      * @exception MessageServiceException
350      */

351     public void clearBody() throws MessageServiceException;
352     
353     
354     /**
355      * This method clears the properties assigned to this message.
356      *
357      * @exception MessageServiceException
358      */

359     public void clearProperties() throws MessageServiceException;
360     
361     
362     /**
363      * This method returns true if the property is found.
364      *
365      * @return TRUE if the property is found, FALSE if not.
366      * @param name The name of the property.
367      * @exception MessageServiceException
368      */

369     public boolean containsProperty(String JavaDoc name) throws MessageServiceException;
370     
371     
372     /**
373      * This method returns the boolean property value for the requested name.
374      *
375      * @return The value of the boolean property.
376      * @param name The name of the property.
377      * @exception MessageServiceException
378      * @exception InvalidProperty
379      */

380     public boolean getBooleanProperty(String JavaDoc name) throws
381             MessageServiceException, InvalidProperty;
382     
383     
384     /**
385      * This method returns the byte property value for the requested name.
386      *
387      * @return The value of the byte property.
388      * @param name The name of the property.
389      * @exception MessageServiceException
390      * @exception InvalidProperty
391      */

392     public byte getByteProperty(String JavaDoc name) throws
393             MessageServiceException, InvalidProperty;
394     
395     
396     /**
397      * This method returns the double property value for the requested name.
398      *
399      * @return The value of the byte property.
400      * @param name The name of the property.
401      * @exception MessageServiceException
402      * @exception InvalidProperty
403      */

404     public double getDoubleProperty(String JavaDoc name) throws
405             MessageServiceException, InvalidProperty;
406     
407     
408     /**
409      * This method returns the float property value for the requested name.
410      *
411      * @return The value of the float property.
412      * @param name The name of the property.
413      * @exception MessageServiceException
414      * @exception InvalidProperty
415      */

416     public float getFloatProperty(String JavaDoc name) throws
417             MessageServiceException, InvalidProperty;
418     
419     
420     /**
421      * This method returns the int property value for the requested name.
422      *
423      * @return The value of the int property.
424      * @param name The name of the property.
425      * @exception MessageServiceException
426      * @exception InvalidProperty
427      */

428     public int getIntProperty(String JavaDoc name) throws
429             MessageServiceException, InvalidProperty;
430     
431     
432     /**
433      * This method returns the long property value for the requested name.
434      *
435      * @return The value of the long property.
436      * @param name The name of the property.
437      * @exception MessageServiceException
438      * @exception InvalidProperty
439      */

440     public long getLongProperty(String JavaDoc name) throws
441             MessageServiceException, InvalidProperty;
442     
443     
444     /**
445      * This method returns the object property value for the requested name.
446      *
447      * @return The value of the object property.
448      * @param name The name of the property.
449      * @exception MessageServiceException
450      * @exception InvalidProperty
451      */

452     public Object JavaDoc getObjectProperty(String JavaDoc name) throws
453             MessageServiceException, InvalidProperty;
454     
455     
456     /**
457      * This method returns the string property value for the requested name.
458      *
459      * @return The value of the string property.
460      * @param name The name of the property.
461      * @exception MessageServiceException
462      * @exception InvalidProperty
463      */

464     public String JavaDoc getStringProperty(String JavaDoc name) throws
465             MessageServiceException, InvalidProperty;
466     
467     
468     /**
469      * This method returns the value of the property.
470      *
471      * @return The value of the property.
472      * @param name The name of the property.
473      * @exception MessageServiceException
474      * @exception InvalidProperty
475      */

476     public Object JavaDoc getPropertyValue(String JavaDoc name) throws
477             MessageServiceException, InvalidProperty;
478     
479     
480     /**
481      * This method returns the string property value for the requested name.
482      *
483      * @return The list of property names
484      * @exception MessageServiceException
485      */

486     public Enumeration JavaDoc getPropertyNames() throws MessageServiceException;
487     
488     
489     /**
490      * This method returns true if the specified property exits.
491      *
492      * @return TRUE if the property exists, FALSE if not.
493      * @param name The name of the property to look for.
494      * @exception MessageServiceException
495      */

496     public boolean propertyExists(String JavaDoc name) throws MessageServiceException;
497     
498     
499     /**
500      * This method sets the boolean property value for the name.
501      *
502      * @param name The name of the property.
503      * @param value The value of the boolean property.
504      * @exception MessageServiceException
505      */

506     public void setBooleanProperty(String JavaDoc name, boolean value) throws
507             MessageServiceException;
508     
509     
510     /**
511      * This method sets the byte property value for the name.
512      *
513      * @param name The name of the property.
514      * @param value The value of the byte property.
515      * @exception MessageServiceException
516      */

517     public void setByteProperty(String JavaDoc name, byte value) throws
518             MessageServiceException;
519     
520     
521     /**
522      * This method sets the double property value for the name.
523      *
524      * @param name The name of the property.
525      * @param value The value of the double property.
526      * @exception MessageServiceException
527      */

528     public void setDoubleProperty(String JavaDoc name, double value) throws
529             MessageServiceException;
530     
531     
532     /**
533      * This method sets the float property value for the name.
534      *
535      * @param name The name of the property.
536      * @param value The value of the float property.
537      * @exception MessageServiceException
538      */

539     public void setFloatProperty(String JavaDoc name, float value) throws
540             MessageServiceException;
541     
542     
543     /**
544      * This method set the int property value for the name.
545      *
546      * @param name The name of the property.
547      * @param value The value of the int property.
548      * @exception MessageServiceException
549      */

550     public void setIntProperty(String JavaDoc name, int value) throws
551             MessageServiceException;
552     
553     
554     /**
555      * This method sets the long property value for the name.
556      *
557      * @param name The name of the property.
558      * @return value The new long value.
559      * @exception MessageServiceException
560      */

561     public void setLongProperty(String JavaDoc name, long value) throws
562             MessageServiceException;
563     
564     
565     /**
566      * This method returns the object property value for the name.
567      *
568      * @param name The name of the property.
569      * @param value The new object value to set.
570      * @exception MessageServiceException
571      * @exception InvalidProperty
572      */

573     public void setObjectProperty(String JavaDoc name, Object JavaDoc value) throws
574             MessageServiceException;
575     
576     
577     /**
578      * This method sets the string property value for the name.
579      *
580      * @param name The name of the property.
581      * @return value The new string value to set.
582      * @exception MessageServiceException
583      */

584     public void setStringProperty(String JavaDoc name, String JavaDoc value) throws
585             MessageServiceException;
586     
587     
588     /**
589      * This method sets the value of the property.
590      *
591      * @param name The name of the property.
592      * @param value The property value.
593      * @exception MessageServiceException
594      * @exception InvalidProperty
595      */

596     public void setPropertyValue(String JavaDoc name,Object JavaDoc value) throws
597             MessageServiceException, InvalidProperty;
598     
599     
600     /**
601      * This method acknowledges that this message has been successfully
602      * processed by a target.
603      *
604      * @exception MessageServiceException
605      */

606     public void acknowledge() throws MessageServiceException;
607     
608     
609     /**
610      * This method returns the value of the acknowledged flag for this message.
611      *
612      * @return TRUE if acknowleded, FALSE if not.
613      * @exception MessageServiceException
614      */

615     public boolean isAcknowledged() throws MessageServiceException;
616     
617     
618     /**
619      * This method returns the current state of this message.
620      *
621      * @return The current state of this message.
622      * @exception MessageServiceException
623      */

624     public int getState() throws MessageServiceException;
625     
626     
627     /**
628      * This method returns list of errors
629      */

630     public List JavaDoc getErrors() throws MessageServiceException;
631     
632     
633     /**
634      * This method adds an error to the list of errors for this message.
635      *
636      * @param level The level of the error.
637      * @param msg The message associated with the error.
638      */

639     public void addError(int level, String JavaDoc msg) throws MessageServiceException;
640 }
641
Popular Tags