001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.lib.collab;
043:
044: /**
045: *
046: *
047: * @since version 0.1
048: *
049: */
050: public interface Message extends MessagePart {
051:
052: /**
053: * acknowledge reception of the message
054: * @param status as defined in MessageStatus
055: * @see MessageStatus
056: */
057: public void sendStatus(int status) throws CollaborationException;
058:
059: /**
060: * send a reply to the alert message
061: * @param message reply message. The reply message must be implemented with the
062: * createReply method.
063: *
064: */
065: public void sendReply(Message message)
066: throws CollaborationException;
067:
068: /**
069: * returns the originator address
070: * @return originator address
071: */
072: public String getOriginator();
073:
074: /**
075: * returns the originator address
076: * @return originator address
077: */
078: public void setOriginator(String originator)
079: throws CollaborationException;
080:
081: /**
082: * adds a recipient to a message
083: * @param destination recipient's address
084: */
085: public void addRecipient(String destination)
086: throws CollaborationException;
087:
088: /**
089: * removes a recipient from the recipient list of a message.
090: * @param destination recipient's address
091: */
092: public void removeRecipient(String destination)
093: throws CollaborationException;
094:
095: /**
096: * get the recipients of the message.
097: * @return array of recipient addresses
098: */
099: public String[] getRecipients() throws CollaborationException;
100:
101: /**
102: * returns the message identifier. The message identifier is generated
103: * by the provider.
104: * @return message identifier
105: */
106: public String getMessageId();
107:
108: /**
109: * returns the date of expiration of this message.
110: * @return message expiration date
111: */
112: public java.util.Date getExpirationDate();
113:
114: /**
115: * instantiates a new body part.
116: * Note that this is not equivalent to adding a part. It merely
117: * instantiates a MessagePart object which can be added to
118: * this message when complete.
119: * @see Message#addPart
120: * @return new, empty message part
121: */
122: public MessagePart newPart() throws CollaborationException;
123:
124: /**
125: * get the value of a header
126: */
127: public String getHeader(String header);
128:
129: /**
130: * set the value of a header
131: */
132: public void setHeader(String header, String value)
133: throws CollaborationException;
134:
135: /**
136: * adds a body part to the end of the message being built
137: * @param part message bodypart to add.
138: */
139: public void addPart(MessagePart part) throws CollaborationException;
140:
141: /**
142: * removes a bodypart
143: * @param part Message Part tp remove.
144: */
145: public void removePart(MessagePart part)
146: throws CollaborationException;
147:
148: /**
149: * get the nested parts of a multi-part message or message part
150: */
151: public MessagePart[] getParts();
152:
153: /**
154: * @param expireAt date at which the message will expire
155: * @deprecated use addProcessingRule
156: */
157: public void setExpirationDate(java.util.Date expireAt)
158: throws CollaborationException;
159:
160: /**
161: * adds a message processing rule at the end of the rule set.
162: * Rules are to be processed by the service in the order in
163: * which they are specified, until one matches.
164: *
165: * @param condition matching condition for this rule
166: * @param action what to do if the condition is matched
167: * @exception ServiceUnavailableException the service does not support
168: * user-controlled message processing or does not support the specific
169: * action/condition combination provided
170: * @exception IllegalArgumentException if the condition or action is null
171: */
172: public MessageProcessingRule addProcessingRule(
173: MessageProcessingRule.Condition condition,
174: MessageProcessingRule.Action action)
175: throws ServiceUnavailableException,
176: IllegalArgumentException;
177:
178: /**
179: * insert a message processing rule at the given position
180: * rules are to be processed by the service in the order in
181: * which they are specified, until one matches.
182: * @param index position of the rule within the rule set. Order
183: * of rule matters since they are applied sequentially until a
184: * match is found.
185: * @param condition matching condition for this rule
186: * @param action what to do if the condition is matched
187: * @exception ServiceUnavailableException the service does not support
188: * user-controlled message processing.
189: * @exception IndexOutOfBoundsException if the index is out of range
190: * @exception IllegalArgumentException if the condition or action is null
191: */
192: public MessageProcessingRule addProcessingRule(int index,
193: MessageProcessingRule.Condition condition,
194: MessageProcessingRule.Action action)
195: throws ServiceUnavailableException,
196: IndexOutOfBoundsException, IllegalArgumentException;
197:
198: /**
199: * adds a message processing rule at the end of the rule set.
200: * Rules are to be processed by the service in the order in
201: * which they are specified, until one matches.
202: *
203: * @param conditions compound conditions. When setting multiple conditions
204: * the resulting condition is equivalent to the intersection
205: * of all individual conditions. i.e. The rule matches only messages
206: * which match all individual conditions.
207: * @param action what to do if the condition is matched
208: * @exception ServiceUnavailableException the service does not support
209: * user-controlled message processing or does not support the specific
210: * action/condition combination provided. It may also happen that the
211: * implementation does not support multi-condition rules.
212: * @exception IllegalArgumentException the conditions array is either
213: * empty or contains multiple conditions of the same type.
214: public MessageProcessingRule addProcessingRule(MessageProcessingRule.Condition[] conditions, MessageProcessingRule.Action action)
215: throws ServiceUnavailableException, IllegalArgumentException;
216: */
217:
218: /**
219: * insert a message processing rule at the given position
220: * rules are to be processed by the service in the order in
221: * which they are specified, until one matches.
222: * @param index position of the rule within the rule set. Order
223: * of rule matters since they are applied sequentially until a
224: * match is found.
225: * @param conditions compound conditions. When setting multiple conditions
226: * the resulting condition is equivalent to the intersection
227: * of all individual conditions. i.e. The rule matches only messages
228: * which match all individual conditions.
229: * @param action what to do if the condition is matched
230: * @exception ServiceUnavailableException the service does not support
231: * user-controlled message processing. It may also happen that the
232: * implementation does not support multi-condition rules.
233: * @exception IllegalArgumentException the conditions array is either
234: * empty or contains multiple conditions of the same type.
235: public MessageProcessingRule addProcessingRule(int index, MessageProcessingRule.Condition[] conditions, MessageProcessingRule.Action action)
236: throws ServiceUnavailableException, IndexOutOfBoundsException, IllegalArgumentException;
237: */
238:
239: /**
240: * removes a message processing rule.
241: * @param rule the rule to remove
242: * @return true if a matching rule was present and effectively
243: * removed from this, false otherwise
244: */
245: public boolean removeProcessingRule(MessageProcessingRule rule);
246:
247: /**
248: * removes a message processing rule.
249: * @param index position of the rule to remove
250: * @return true if a matching rule was present and effectively
251: * removed from this, false otherwise
252: */
253: public MessageProcessingRule removeProcessingRule(int index)
254: throws IndexOutOfBoundsException;
255:
256: }
|