org/objectweb/joram/shared/admin/AddDomainRequest.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 AddDomainRequest extends AdminRequest {
00033   private static final long serialVersionUID = 1L;
00034   private String domainName;
00035   private String network;
00036   private int serverId;
00037   private int port;
00038 
00039   public AddDomainRequest(String domainName,
00040                           String network,
00041                           int serverId,
00042                           int port) {
00043     this.domainName = domainName;
00044     this.network = network;
00045     this.serverId = serverId;
00046     this.port = port;
00047   }
00048 
00049   public AddDomainRequest(String domainName,
00050                           int serverId,
00051                           int port) {
00052     this.domainName = domainName;
00053     this.network = null;
00054     this.serverId = serverId;
00055     this.port = port;
00056   }
00057 
00058   public AddDomainRequest() { }
00059   
00060   public final String getDomainName() {
00061     return domainName;
00062   }
00063   
00064   public final String getNetwork() {
00065     if (network == null)
00066       return "fr.dyade.aaa.agent.SimpleNetwork";
00067     return network;
00068   }
00069 
00070   public final int getServerId() {
00071     return serverId;
00072   }
00073 
00074   public final int getPort() {
00075     return port;
00076   }
00077 
00078   protected int getClassId() {
00079     return ADD_DOMAIN_REQUEST;
00080   }
00081 
00082   public void readFrom(InputStream is) throws IOException {
00083     domainName = StreamUtil.readStringFrom(is);
00084     network = StreamUtil.readStringFrom(is);
00085     serverId = StreamUtil.readIntFrom(is);
00086     port = StreamUtil.readIntFrom(is);
00087   }
00088 
00089   public void writeTo(OutputStream os) throws IOException {
00090     StreamUtil.writeTo(domainName, os);
00091     StreamUtil.writeTo(network, os);
00092     StreamUtil.writeTo(serverId, os);
00093     StreamUtil.writeTo(port, os);
00094   }
00095 }

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