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: /**
023: * @author <a href="mailto:Takoua.Abdellatif@inria.fr">Takoua Abdellatif </a>
024: * @author Adriana Danes
025: * @version 1.0
026: */
027: public class DiscEvent extends DiscMessage {
028: /**
029: *
030: */
031: private String serverName = null;
032: /**
033: *
034: */
035: private String domainName = null;
036: /**
037: *
038: */
039: private String state = null;
040: /**
041: *
042: */
043: private String serverId = null;
044:
045: /**
046: *
047: */
048: private String[] urls = null;
049:
050: /**
051: * @param sourceAddress
052: * @param sourcePort
053: * @param serverId The serverId for this server.
054: */
055: public DiscEvent(String sourceAddress, int sourcePort,
056: String serverId) {
057: super (sourceAddress, sourcePort);
058: }
059:
060: /**
061: * Constructor for a Discovery Event.
062: * @param sourceAddress
063: * the host address to use to receive a response.
064: * @param sourcePort
065: * is the port used in the case of a point to point response.
066: * @param serverName
067: * is Jonas server name.
068: * @param domainName
069: * is Jonas domain name.
070: * @param serverId TODO
071: * @param connectorURLs
072: * contains the list of all connector urls registered in the mbean
073: * server.
074: */
075: public DiscEvent(String sourceAddress, int sourcePort,
076: String serverName, String domainName, String serverId,
077: String[] connectorURLs) {
078: super (sourceAddress, sourcePort);
079: this .serverName = serverName;
080: this .domainName = domainName;
081: this .serverId = serverId;
082: this .urls = connectorURLs;
083: }
084:
085: /**
086: * returns server name.
087: *
088: * @return serverName
089: */
090: public String getServerName() {
091: return serverName;
092: }
093:
094: /**
095: * returns domain name.
096: *
097: * @return domain name.
098: */
099: public String getDomainName() {
100: return domainName;
101: }
102:
103: /**
104: * sets the domain name.
105: *
106: * @param domainName the management domain name
107: */
108: public void setDomainName(String domainName) {
109: this .domainName = domainName;
110: }
111:
112: /**
113: * sets the serverName
114: *
115: * @param serverName the name of the server sending the discovery event
116: */
117: public void setServerName(String serverName) {
118: this .serverName = serverName;
119: }
120:
121: /**
122: * @return the connector URLs of the server sending the discovery event
123: */
124: public String[] getConnectorURL() {
125: return urls;
126: }
127:
128: /**
129: * @param connectorURLs the connector URLs of the server sending the discovery event
130: */
131: public void setConnectorURL(String[] connectorURLs) {
132: this .urls = connectorURLs;
133: }
134:
135: /**
136: * @return server state.
137: */
138: public String getState() {
139: return state;
140: }
141:
142: /**
143: * sets the server state : RUNNING or STOPPING.
144: *
145: * @param state state of the server sending the discovery event
146: */
147: public void setState(String state) {
148: this .state = state;
149: }
150:
151: /**
152: * The string version of the message
153: * @return the message
154: */
155: public String toString() {
156: String str = super .toString() + " State=" + state
157: + " DomainName=" + domainName + " ServerName= "
158: + serverName + " Serverid = " + serverId;
159: if (urls != null) {
160: str = str + " URLs= ";
161: for (int i = 0; i < urls.length; i++) {
162: str = str + urls[i] + " ";
163: }
164: }
165: return str;
166:
167: }
168:
169: public String getServerId() {
170: return serverId;
171: }
172:
173: public void setServerId(String serverId) {
174: this.serverId = serverId;
175: }
176:
177: }
|