001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or modify it
007: * under the terms of the GNU Lesser General Public License as published by the
008: * Free Software Foundation; either version 2.1 of the License, or any later
009: * version.
010: *
011: * This library is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
014: * for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public License
017: * along with this library; if not, write to the Free Software Foundation,
018: * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
019: *
020: */package org.objectweb.jonas.discovery;
021:
022: import java.io.Serializable;
023:
024: /**
025: * @author <a href="mailto:Takoua.Abdellatif@inria.fr">Takoua Abdellatif </a>
026: * @author Adriana Danes
027: * @version 1.1
028: */
029: public class DiscMessage implements Serializable {
030: /**
031: * The protocol version for the Discovery messages.
032: */
033: public static final String DISCOVERY_PROTOCOL_VERSION = "1.1";
034: /**
035: * The version for this message
036: */
037: private String version;
038: /**
039: *
040: */
041: private String sourceAddress;
042: /**
043: *
044: */
045: private int sourcePort;
046:
047: /**
048: * Creates a new <code>DiscoveryRequest</code>
049: * @param sourceAddress
050: * source address to use to send discovery responses.
051: * @param sourcePort
052: * source port to use to send disovery responses.
053: *
054: */
055: public DiscMessage(String sourceAddress, int sourcePort) {
056: this .sourceAddress = sourceAddress;
057: this .sourcePort = sourcePort;
058: this .version = DISCOVERY_PROTOCOL_VERSION;
059: }
060:
061: /**
062: * Returns the destinationAddress value in String type.
063: *
064: * @return Returns the destinationAddress.
065: */
066: public String getSourceAddress() {
067: return sourceAddress;
068: }
069:
070: /**
071: * Returns the sourcePort value.
072: *
073: * @return Returns the sourcePort.
074: */
075: public int getSourcePort() {
076: return sourcePort;
077: }
078:
079: /**
080: * Sets the source address.
081: *
082: * @param sourceAddress
083: */
084: public void setSourceAddress(String sourceAddress) {
085: this .sourceAddress = sourceAddress;
086: }
087:
088: /**
089: * Sets the source port.
090: *
091: * @param sourcePort
092: */
093: public void setSourcePort(int sourcePort) {
094: this .sourcePort = sourcePort;
095: }
096:
097: /**
098: * @return the object trandformed into a String
099: */
100: public String toString() {
101: String messageString = null;
102: messageString = "SourceAddress= " + sourceAddress
103: + " SourcePort= " + sourcePort;
104: return messageString;
105: }
106:
107: /**
108: *
109: * @return discovery protocol version
110: */
111: public String getVersion() {
112: return version;
113: }
114:
115: }
|