001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.kuali.kfs.batch;
017:
018: import java.util.ArrayList;
019: import java.util.HashMap;
020: import java.util.List;
021: import java.util.Map;
022:
023: import org.kuali.kfs.service.SchedulerService;
024: import org.quartz.JobDetail;
025: import org.springframework.beans.factory.BeanNameAware;
026:
027: public class JobDescriptor implements BeanNameAware {
028: private String name;
029: private String group;
030: private Map<String, String> dependencies;
031: private List<Step> steps;
032: private SchedulerService schedulerService;
033: private boolean durable = true;
034:
035: public JobDescriptor() {
036: dependencies = new HashMap();
037: steps = new ArrayList();
038: }
039:
040: public JobDescriptor(String name, String group, Step step,
041: boolean durable) {
042: this ();
043: this .name = name;
044: this .group = group;
045: this .durable = durable;
046: steps.add(step);
047: }
048:
049: /**
050: * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
051: */
052: public void setBeanName(String name) {
053: this .name = name;
054: }
055:
056: /**
057: * Constructs a non-volatile, durable, non-recoverable JobDetail w/ org.kuali.kfs.batch.Job as the job class and the specified
058: * name and group from this instance. Also adds status=Pending to the JobDataMap, if this is a scheduled job.
059: *
060: * @return the org.quartz.JobDetail corresponding to this instance
061: */
062: public JobDetail getJobDetail() {
063: return new JobDetail(name, group, Job.class, false, durable,
064: false);
065: }
066:
067: /**
068: * Sets the group attribute value.
069: *
070: * @param group The group to set.
071: */
072: public void setGroup(String group) {
073: this .group = group;
074: }
075:
076: /**
077: * Sets the dependencies attribute value.
078: *
079: * @param dependencies The dependencies to set.
080: */
081: public void setDependencies(Map<String, String> dependencies) {
082: this .dependencies = dependencies;
083: }
084:
085: /**
086: * Gets the dependencies attribute.
087: *
088: * @return Returns the dependencies.
089: */
090: public Map<String, String> getDependencies() {
091: return dependencies;
092: }
093:
094: /**
095: * Sets the steps attribute value.
096: *
097: * @param steps The steps to set.
098: */
099: public void setSteps(List<Step> steps) {
100: this .steps = steps;
101: }
102:
103: /**
104: * Gets the steps attribute.
105: *
106: * @return Returns the steps.
107: */
108: public List<Step> getSteps() {
109: return steps;
110: }
111:
112: /**
113: * Sets the schedulerService attribute value.
114: *
115: * @param schedulerService The schedulerService to set.
116: */
117: public void setSchedulerService(SchedulerService schedulerService) {
118: this .schedulerService = schedulerService;
119: }
120:
121: public String getGroup() {
122: return group;
123: }
124:
125: public String getName() {
126: return name;
127: }
128:
129: public SchedulerService getSchedulerService() {
130: return schedulerService;
131: }
132:
133: public boolean isDurable() {
134: return durable;
135: }
136:
137: public void setDurable(boolean durable) {
138: this.durable = durable;
139: }
140: }
|