00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
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     
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     
00071     
00072 
00076     VirtualMachineImpl() {
00077     }
00078 
00079     
00080     
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 }