org/objectweb/joram/shared/admin/AddServerRequest.java

00001 /*
00002  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
00003  * Copyright (C) 2001 - 2007 ScalAgent Distributed Technologies
00004  * Copyright (C) 1996 - 2000 Dyade
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA.
00020  *
00021  * Initial developer(s): ScalAgent Distributed Technologies
00022  * Contributor(s):
00023  */
00024 package org.objectweb.joram.shared.admin;
00025 
00026 import java.io.IOException;
00027 import java.io.InputStream;
00028 import java.io.OutputStream;
00029 
00030 import org.objectweb.joram.shared.stream.StreamUtil;
00031 
00032 public class AddServerRequest extends AdminRequest {
00033 
00034   private static final long serialVersionUID = 1L;
00035 
00036   private String serverName;
00037   private String hostName;
00038   private int serverId;
00039   private String domainName;
00040   private int port;
00041   private String[] serviceNames;
00042   private String[] serviceArgs;
00043 
00044   public AddServerRequest(int serverId,
00045                           String hostName,
00046                           String domainName,
00047                           int port,
00048                           String serverName,
00049                           String[] serviceNames,
00050                           String[] serviceArgs) {
00051     this.serverId = serverId;
00052     this.hostName = hostName;
00053     this.serverName = serverName;
00054     this.domainName = domainName;
00055     this.port = port;
00056     this.serviceNames = serviceNames;
00057     this.serviceArgs = serviceArgs;
00058   }
00059 
00060   public AddServerRequest() { }
00061   
00062   public final String getServerName() {
00063     return serverName;
00064   }
00065 
00066   public final String getHostName() {
00067     return hostName;
00068   }
00069 
00070   public final int getServerId() {
00071     return serverId;
00072   }
00073 
00074   public final String getDomainName() {
00075     return domainName;
00076   }
00077 
00078   public final int getPort() {
00079     return port;
00080   }
00081 
00082   public final String[] getServiceNames() {
00083     return serviceNames;
00084   }
00085 
00086   public final String[] getServiceArgs() {
00087     return serviceArgs;
00088   }
00089 
00090   protected int getClassId() {
00091     return ADD_SERVER_REQUEST;
00092   }
00093   
00094   public void readFrom(InputStream is) throws IOException {
00095     domainName = StreamUtil.readStringFrom(is);
00096     hostName = StreamUtil.readStringFrom(is);
00097     port = StreamUtil.readIntFrom(is);
00098     serverId = StreamUtil.readIntFrom(is);
00099     serverName = StreamUtil.readStringFrom(is);
00100     serviceNames = StreamUtil.readArrayOfStringFrom(is);
00101     serviceArgs = StreamUtil.readArrayOfStringFrom(is);
00102   }
00103 
00104   public void writeTo(OutputStream os) throws IOException {
00105     StreamUtil.writeTo(domainName, os);
00106     StreamUtil.writeTo(hostName, os);
00107     StreamUtil.writeTo(port, os);
00108     StreamUtil.writeTo(serverId, os);
00109     StreamUtil.writeTo(serverName, os);
00110     StreamUtil.writeArrayOfStringTo(serviceNames, os);
00111     StreamUtil.writeArrayOfStringTo(serviceArgs, os);
00112   }
00113 }

Generated on Tue Sep 16 16:14:36 2008 for joram by  doxygen 1.5.0