org/objectweb/proactive/scheduler/GenericJob.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.scheduler;
00032 
00033 import java.io.Serializable;
00034 import java.util.Date;
00035 import java.util.Vector;
00036 
00037 import org.objectweb.proactive.Job;
00038 import org.objectweb.proactive.core.UniqueID;
00039 
00040 
00063 public class GenericJob implements Serializable, Job {
00064     private String className;
00065     private int priority;
00066     private int userId;
00067     private Date submitDate;
00068     private Vector mainParameters;
00069 
00070     //    private Node [] nodes;
00071     private int ressourceNb;
00072 
00073     //    private Object[] constructorParameters;
00074     private int estimatedTime;
00075     private String xmlName;
00076     private String xmlFullPath;
00077 
00078     //    private Date startDate;
00079     private UniqueID jobId;
00080     private String jvmParameters;
00081     private String jobStatus;
00082     private String[] classPath;
00083     private int minRessourceNb = 0;
00084 
00085     //  private Date elapsedTime;    
00086     public GenericJob() {
00087         //       this(null, 0, 0, 0, 1, null, null, new Vector(), new Date());
00088         this.setClassName(null);
00089         this.setPriority(0);
00090         this.setUserId(0);
00091         this.setSubmitDate(new Date());
00092         this.setMainParameters(new Vector());
00093         this.setRessourceNb(1);
00094         this.setEstimatedTime(0);
00095         this.jobId = new UniqueID();
00096         this.classPath = null;
00097     }
00098 
00099     /*
00100         public GenericJob(String className, int userId, int estimatedTime) {
00101             this(className, userId, estimatedTime, 0, 1, null, null, null,
00102                 new Date());
00103         }
00104 
00105         public GenericJob(String className, int userId, int estimatedTime,
00106             int priority) {
00107             this(className, userId, estimatedTime, priority, 1, null, null, null,
00108                 new Date());
00109         }
00110 
00111         public GenericJob(String className, int userId, int estimatedTime,
00112             int priority, int ressourceNb) {
00113             this(className, userId, estimatedTime, priority, ressourceNb, null,
00114                 null, null, new Date());
00115         }
00116 
00117         public GenericJob(String className, int userId, int estimatedTime,
00118             int priority, int ressourceNb, Object[] constructorParameters) {
00119             this(className, userId, estimatedTime, priority, ressourceNb,
00120                 constructorParameters, null, null, new Date());
00121         }
00122 
00123         public GenericJob(String className, int userId, int estimatedTime,
00124             int priority, int ressourceNb, Object[] constructorParameters,
00125             Node [] nodes) {
00126             this(className, userId, estimatedTime, priority, ressourceNb,
00127                 constructorParameters, nodes, null, new Date());
00128         }
00129 
00130         public GenericJob(String className, int userId, int estimatedTime,
00131             int priority, int ressourceNb, Object[] constructorParameters,
00132             Node [] nodes, Vector mainParameters) {
00133             this(className, userId, estimatedTime, priority, ressourceNb,
00134                 constructorParameters, nodes, mainParameters, new Date());
00135         }
00136 
00137         public GenericJob(String className, int userId, int estimatedTime,
00138             int priority, int ressourceNb, Object[] constructorParameters,
00139             Node [] nodes, Vector mainParameters, Date submitDate) {
00140             this.setClassName(className);
00141             this.setPriority(priority);
00142             this.setUserId(userId);
00143             this.setSubmitDate(submitDate);
00144             this.setMainParameters(mainParameters);
00145             this.setNodes(nodes);
00146             this.setRessourceNb(ressourceNb);
00147             this.setConstructorParameters(constructorParameters);
00148             this.setEstimatedTime(estimatedTime);
00149 
00150         }
00151     */
00152     public void setClassName(String className) {
00153         this.className = className;
00154     }
00155 
00156     public void setPriority(int priority) {
00157         this.priority = priority;
00158     }
00159 
00160     public void setUserId(int userId) {
00161         this.userId = userId;
00162     }
00163 
00164     public void setSubmitDate() {
00165         this.submitDate = new Date();
00166     }
00167 
00168     public void setSubmitDate(Date submitDate) {
00169         this.submitDate = submitDate;
00170     }
00171 
00172     public void setMainParameters(Vector mainParameters) {
00173         this.mainParameters = mainParameters;
00174     }
00175 
00180     public void addMainParameter(String mainParameter) {
00181         this.mainParameters.add(mainParameter);
00182     }
00183 
00184     /*
00185         public void setNodes(Node [] nodes) {
00186             this.nodes = nodes;
00187         }
00188     */
00189     public void setRessourceNb(int ressourceNb) {
00190         this.ressourceNb = ressourceNb;
00191     }
00192 
00193     /*
00194         public void setConstructorParameters(Object[] constructorParameters) {
00195             this.constructorParameters = constructorParameters;
00196         }
00197     */
00198     public void setEstimatedTime(int estimatedTime) {
00199         this.estimatedTime = estimatedTime;
00200     }
00201 
00202     public String getClassName() {
00203         return this.className;
00204     }
00205 
00206     public int getPriority() {
00207         return this.priority;
00208     }
00209 
00210     public int getUserId() {
00211         return this.userId;
00212     }
00213 
00214     public Date getSubmitDate() {
00215         return this.submitDate;
00216     }
00217 
00218     public String[] getMainParameters() {
00219         String[] mainParameters = new String[this.mainParameters.size()];
00220 
00221         for (int i = 0; i < mainParameters.length; ++i) {
00222             mainParameters[i] = (String) this.mainParameters.elementAt(i);
00223         }
00224 
00225         return mainParameters;
00226     }
00227 
00228     /*
00229         public Node [] getNodes() {
00230             return this.nodes;
00231         }
00232     */
00233     public int getRessourceNb() {
00234         return this.ressourceNb;
00235     }
00236 
00237     /*
00238         public Object[] getConstructorParameters() {
00239             return this.constructorParameters;
00240         }
00241     */
00242     public int getEstimatedTime() {
00243         return this.estimatedTime;
00244     }
00245 
00246     public String getJobID() {
00247         return this.jobId.toString();
00248     }
00249 
00250     public void setXMLDescriptorName(String XMLDescriptorName) {
00251         this.xmlName = XMLDescriptorName;
00252     }
00253 
00254     public String getXMLDescriptorName() {
00255         return this.xmlName;
00256     }
00257 
00258     public void setXMLFullPath(String XMLFullPath) {
00259         this.xmlFullPath = XMLFullPath;
00260     }
00261 
00262     public String getXMLFullPath() {
00263         return this.xmlFullPath;
00264     }
00265 
00266     public void setJVMParameters(String jvmParameters) {
00267         this.jvmParameters = jvmParameters;
00268     }
00269 
00270     public String getJVMParameters() {
00271         return this.jvmParameters;
00272     }
00273 
00274     public void setJobStatus(String jobStatus) {
00275         this.jobStatus = jobStatus;
00276     }
00277 
00278     public String getJobStatus() {
00279         return this.jobStatus;
00280     }
00281 
00282     public String[] getClassPath() {
00283         return this.classPath;
00284     }
00285 
00286     public void setClassPath(String[] classPath) {
00287         this.classPath = classPath;
00288     }
00289 
00290     public void setMinNbOfNodes(int nbOfNodes) {
00291         this.minRessourceNb = nbOfNodes;
00292     }
00293 
00294     public int getMinNbOfNodes() {
00295         return this.minRessourceNb;
00296     }
00297 }

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