View Javadoc

1   /*
2    * Copyright (c) 2005, London e-Science Centre, Imperial College London, UK
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6    *
7    * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8    * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9    * - Neither the name of the London e-Science Centre nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10   *
11   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12   */
13  package org.icenigrid.gridsam.core;
14  
15  import java.util.List;
16  import java.util.Map;
17  import org.icenigrid.schema.jsdl.y2005.m11.JobDefinitionDocument;
18  
19  /**
20   * Interface representing a job instance in the GridSAM JobManager API
21   * 
22   * @author wwhl
23   */
24  public interface JobInstance {
25  
26      /**
27       * the job identifier
28       * 
29       * @return job identifier
30       */
31      public String getID();
32  
33      /**
34       * get the Job description document as a string
35       * 
36       * @return JobDefinitionDocument the jsdl:JobDefinition element
37       */
38      public JobDefinitionDocument getJobDefinition();
39  
40  
41      /**
42       * get the job status history associated with this job instance
43       * 
44       * @return List of JobStage in chronological order
45       */
46      public List getJobStages();
47  
48      /**
49       * test whether the job is currently in the given state
50       * 
51       * @param pState
52       *            the state to test
53       * @return true if getLastKnownStage().getState.equals(pState)
54       */
55      public boolean isInStage(JobState pState);
56  
57      /**
58       * test whether the job has been in the given state
59       * 
60       * @param pState
61       *            the state to test
62       * @return true if some x: getJobStages(), x.getState().equals(pState)
63       */
64      public boolean wasInStage(JobState pState);
65  
66      /**
67       * get the last known job stage
68       * 
69       * @return JobStage same as calling
70       *         getJobStages().get(getJobStages().size()-1)
71       */
72      public JobStage getLastKnownStage();
73  
74      /**
75       * get the properties associated with the job
76       * 
77       * @return Properties list of key-value pairs
78       */
79      public Map getProperties();
80  
81  }