01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.tck.wma;
28:
29: /**
30: * This is the base interface for derived interfaces
31: * representing various types of messages.
32: */
33: public interface Message {
34:
35: /**
36: * Returns the address that this message is associated with.
37: *
38: * <p>If this object represents a message to be sent, this address
39: * is the recipient's address.
40: * </p>
41: * <p>If this object represents a message has been received, this address
42: * is the address of the sender.
43: * </p>
44: * <p>If the address for the message isn't set, <code>null</code>
45: * is returned.
46: * </p>
47: * <p><strong>Note</strong>: Sending responses to a received message
48: * is allowed easily by this design through reusing the same
49: * <code>Message</code> object with the replaced payload.
50: * Unless a special processing of the address is required by the mesaging
51: * protocol that is used, the address field can be left untouched.
52: * </p>
53: * @return <code>null</code> if the address isn't set, or this message's
54: * address.
55: * @see #setAddress(String)
56: */
57: public String getAddress();
58:
59: /**
60: * Sets the address that this message is associated with,
61: * i.e., the address that <code>getAddress</code> method returns.
62: * <code>null</code> is allowed as an address.
63: * @param addr address for the message
64: * @see #getAddress()
65: */
66: public void setAddress(String addr);
67:
68: /**
69: * Returns the timestamp that indicates when this message has been
70: * sent.
71: * @return <code>null</code> either if the timestamp isn't set or
72: * it isn't available in the underlying protocol message,
73: * or <code>Date</code> that indicates the timestamp in the message.
74: */
75: public java.util.Date getTimestamp();
76:
77: }
|