org/objectweb/proactive/core/descriptor/data/VirtualMachineImpl.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.core.descriptor.data;
00032 
00033 import org.objectweb.proactive.core.descriptor.services.UniversalService;
00034 import org.objectweb.proactive.core.process.ExternalProcess;
00035 
00036 
00046 public class VirtualMachineImpl implements VirtualMachine, java.io.Serializable {
00047     //
00048     //  ----- PRIVATE MEMBERS -----------------------------------------------------------------------------------
00049     //
00050 
00052     private String name;
00053 
00055     private String nbNodes = "1";
00056 
00058     private boolean hasProcess = true;
00059 
00061     private ExternalProcess process;
00062 
00064     private UniversalService service;
00065 
00067     private String creatorId = null;
00068 
00069     //
00070     //  ----- CONSTRUCTORS -----------------------------------------------------------------------------------
00071     //
00072 
00076     VirtualMachineImpl() {
00077     }
00078 
00079     //
00080     //  ----- PUBLIC METHODS -----------------------------------------------------------------------------------
00081     //
00082     public void setNbNodes(String nbNodes) throws java.io.IOException {
00083         if (new Integer(nbNodes).intValue() < 1) {
00084             throw new java.io.IOException(
00085                 "Cannot define nbNodes with a value < 1");
00086         }
00087         this.nbNodes = nbNodes;
00088     }
00089 
00090     public String getNbNodesOnCreatedVMs() {
00091         return this.nbNodes;
00092     }
00093 
00094     public void setName(String s) {
00095         name = s;
00096     }
00097 
00098     public String getName() {
00099         return name;
00100     }
00101 
00102     public void setProcess(ExternalProcess p) {
00103         process = p;
00104     }
00105 
00106     public ExternalProcess getProcess() {
00107         return process;
00108     }
00109 
00115     public String getHostName() {
00116         String hostName = process.getHostname();
00117         if (hostName == null) {
00118             hostName = "localhost";
00119         }
00120         return hostName;
00121     }
00122 
00123     public void setCreatorId(String creatorId) {
00124         this.creatorId = creatorId;
00125     }
00126 
00127     public String getCreatorId() {
00128         return this.creatorId;
00129     }
00130 
00134     public boolean hasProcess() {
00135         return hasProcess;
00136     }
00137 
00141     public void setService(UniversalService service) {
00142         hasProcess = false;
00143         this.service = service;
00144     }
00145 
00149     public String getUserClass() {
00150         return this.getClass().getName();
00151     }
00152 
00156     public UniversalService getService() {
00157         return service;
00158     }
00159 }

Generated on Mon Jan 22 15:16:07 2007 for ProActive by  doxygen 1.5.1