View Javadoc

1   /*
2    * Copyright 2007-2008 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.gwe.persistence.model;
18  
19  import javax.persistence.Entity;
20  import javax.persistence.GeneratedValue;
21  import javax.persistence.GenerationType;
22  import javax.persistence.Id;
23  
24  import org.apache.commons.logging.Log;
25  import org.apache.commons.logging.LogFactory;
26  
27  /**
28   * @author Marco Ruiz
29   * @since Jun 24, 2008
30   */
31  enum Launch{ AUTO, MANUAL, NOTIFICATION; } 
32  enum CleanUp{ ALWAYS, ON_SUCCESS, NEVER; } 
33  
34  @Entity
35  public final class OrderExecutionProfileInfo extends BaseModelInfo<Integer> {
36  
37  	private static Log log = LogFactory.getLog(OrderExecutionProfileInfo.class);
38  	
39      @Id 
40      @GeneratedValue(strategy=GenerationType.AUTO) 
41  	private int id;
42  	
43  	private int launchMode = Launch.AUTO.ordinal();
44  	private int cleanUpMode = CleanUp.ALWAYS.ordinal();
45  	
46  	private int maxJobRunningTime = -1;
47  	private int maxRetries = 3;
48  	private int maxConcurrentRunningJobs = -1;
49  	private int maxPreparedJobs = 10;
50  	private int diskSpaceForVFS = -1;
51  
52  	private boolean useVFSCache = true;
53  	private int mpiMachinesPerJob = 1;
54  
55  //	@Lob
56  //    private Set<String> preInstallBundleIds = new HashSet<String>();
57  	
58      public Integer getId() {
59  	    return id;
60      }
61  
62  	public int getLaunchMode() {
63      	return launchMode;
64      }
65  
66  	public Launch getLaunchModeEnum() {
67      	return Launch.values()[launchMode];
68      }
69  
70  	public void setLaunchMode(int launchMode) {
71      	this.launchMode = launchMode;
72      }
73  
74  	public int getCleanUpMode() {
75      	return cleanUpMode;
76      }
77  
78  	public CleanUp getCleanUpModeEnum() {
79      	return CleanUp.values()[cleanUpMode];
80      }
81  
82  	public void setCleanUpMode(int cleanUpMode) {
83      	this.cleanUpMode = cleanUpMode;
84      }
85  
86  	public boolean isCleanUpModeAlways() {
87      	return cleanUpMode == CleanUp.ALWAYS.ordinal();
88      }
89  
90  	public boolean isCleanUpModeOnSuccess() {
91      	return cleanUpMode == CleanUp.ON_SUCCESS.ordinal();
92      }
93  
94  	public boolean isCleanUpModeNever() {
95      	return cleanUpMode == CleanUp.NEVER.ordinal();
96      }
97  
98  	public int getMaxJobRunningTime() {
99      	return maxJobRunningTime;
100     }
101 
102 	public void setMaxJobRunningTime(int maxJobRunningTime) {
103     	this.maxJobRunningTime = maxJobRunningTime;
104     }
105 
106 	public int getMaxRetries() {
107     	return maxRetries;
108     }
109 
110 	public void setMaxRetries(int maxRetries) {
111     	this.maxRetries = maxRetries;
112     }
113 
114 	public int getMaxConcurrentRunningJobs() {
115     	return maxConcurrentRunningJobs;
116     }
117 
118 	public void setMaxConcurrentRunningJobs(int maxConcurrentRunningJobs) {
119     	this.maxConcurrentRunningJobs = maxConcurrentRunningJobs;
120     }
121 
122 	public int getMaxPreparedJobs() {
123     	return maxPreparedJobs;
124     }
125 
126 	public void setMaxPreparedJobs(int maxPreparedJobs) {
127     	this.maxPreparedJobs = maxPreparedJobs;
128     }
129 
130 	public int getDiskSpaceForVFS() {
131     	return diskSpaceForVFS;
132     }
133 
134 	public void setDiskSpaceForVFS(int diskSpaceForVFS) {
135     	this.diskSpaceForVFS = diskSpaceForVFS;
136     }
137 
138 	public boolean isUseVFSCache() {
139     	return useVFSCache;
140     }
141 
142 	public void setUseVFSCache(boolean useVFSCache) {
143     	this.useVFSCache = useVFSCache;
144     }
145 
146 	public int getMpiMachinesPerJob() {
147     	return mpiMachinesPerJob;
148     }
149 
150 	public void setMpiMachinesPerJob(int mpiMachinesPerJob) {
151     	this.mpiMachinesPerJob = mpiMachinesPerJob;
152     }
153 /*
154 	public Set<String> getPreInstallBundleIds() {
155     	return preInstallBundleIds;
156     }
157 
158 	public void setPreInstallBundleIds(Set<String> preInstallBundleIds) {
159     	this.preInstallBundleIds = preInstallBundleIds;
160     }
161 */
162 	public OrderExecutionProfileInfo clone() {
163 	    OrderExecutionProfileInfo result = new OrderExecutionProfileInfo();
164 		result.launchMode = this.launchMode;
165 		result.cleanUpMode = this.cleanUpMode;
166 		
167 		result.maxJobRunningTime = this.maxJobRunningTime;
168 		result.maxRetries = this.maxRetries;
169 		result.maxConcurrentRunningJobs = this.maxConcurrentRunningJobs;
170 		result.maxPreparedJobs = this.maxPreparedJobs;
171 		result.diskSpaceForVFS = this.diskSpaceForVFS;
172 
173 		result.useVFSCache = this.useVFSCache;
174 		result.mpiMachinesPerJob = this.mpiMachinesPerJob;
175 		
176 		return result;
177     }
178 }