View Javadoc

1   /*$Id: ActivityStatus.java,v 1.3 2004/09/06 16:30:25 nw Exp $
2    * Created on 26-Jul-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.jes.jobscheduler.impl.groovy;
12  
13  
14  /*** Represents the status of an activity (step) in the workflow.
15   * its a pretty dumb bean.
16   * @author Noel Winstanley nw@jb.man.ac.uk 26-Jul-2004
17   *
18   */
19  public class ActivityStatus {
20  
21      /*** Construct a new ActivityStatus
22       * 
23       */
24      public ActivityStatus() {
25          super();
26      }
27  
28      protected String key;
29      protected Status status = Status.UNSTARTED;
30      protected Vars env = new Vars();
31  
32      /*** Access the environment of bindings in scope for this activity.
33       * @return Returns the env. defaults to an empty set of bindings.
34       */
35      public Vars getEnv() {        
36          return this.env;
37      }
38      /*** set the environment of bindings available to this activity */
39      public void setEnv(Vars env) {
40         this.env = env;
41      }
42    
43      
44      /***
45       * @return Returns the key.
46       */
47      public String getKey() {
48          return this.key;
49      }
50      /***
51       * @param key The key to set.
52       */
53      public void setKey(String key) {
54          this.key = key;
55      }
56      /*** access the execution status this activity is currently in
57       * @return Returns the status. defaults to {@link Status#UNSTARTED}
58       */
59      public Status getStatus() {
60          return this.status;
61      }
62      /*** set the execution status of this activity.
63       * @param status The status to set.
64       */
65      public void setStatus(Status status) {
66          this.status = status;
67      }
68      public String toString() {
69          StringBuffer buffer = new StringBuffer();
70          buffer.append("[ActivityStatus:");
71          buffer.append(" key: ");
72          buffer.append(key);
73          buffer.append(" status: ");
74          buffer.append(status);
75          buffer.append(" env: ");
76          buffer.append(env);
77          buffer.append("]");
78          return buffer.toString();
79      }
80      /***
81       * Returns <code>true</code> if this <code>ActivityStatus</code> is the same as the o argument.
82       *
83       * @return <code>true</code> if this <code>ActivityStatus</code> is the same as the o argument.
84       */
85      public boolean equals(Object o) {
86          if (this == o) {
87              return true;
88          }
89          if (o == null) {
90              return false;
91          }
92          if (o.getClass() != getClass()) {
93              return false;
94          }
95          ActivityStatus castedObj = (ActivityStatus) o;
96          return ((this.key == null ? castedObj.key == null : this.key
97              .equals(castedObj.key))
98              && (this.status == null ? castedObj.status == null : this.status
99                  .equals(castedObj.status)) && (this.env == null
100             ? castedObj.env == null
101             : this.env.equals(castedObj.env)));
102     }
103     /***
104      * Override hashCode.
105      *
106      * @return the Objects hashcode.
107      */
108     public int hashCode() {
109         int hashCode = 1;
110         hashCode = 31 * hashCode + (key == null ? 0 : key.hashCode());
111         hashCode = 31 * hashCode + (status == null ? 0 : status.hashCode());
112         hashCode = 31 * hashCode + (env == null ? 0 : env.hashCode());
113         return hashCode;
114     }
115 }
116 
117 
118 /* 
119 $Log: ActivityStatus.java,v $
120 Revision 1.3  2004/09/06 16:30:25  nw
121 javadoc
122 
123 Revision 1.2  2004/07/30 15:42:34  nw
124 merged in branch nww-itn06-bz#441 (groovy scripting)
125 
126 Revision 1.1.2.4  2004/07/28 16:24:23  nw
127 finished groovy beans.
128 moved useful tests from old python package.
129 removed python implemntation
130 
131 Revision 1.1.2.3  2004/07/27 23:50:09  nw
132 removed betwixt (duff). replaces with xstream.
133 
134 Revision 1.1.2.2  2004/07/27 23:37:59  nw
135 refactoed framework.
136 experimented with betwixt - can't get it to work.
137 got XStream working in 5 mins.
138 about to remove betwixt code.
139 
140 Revision 1.1.2.1  2004/07/26 15:51:19  nw
141 first stab at a groovy scheduler.
142 transcribed all the classes in the python prototype, and took copies of the
143 classes in the 'scripting' package.
144  
145 */