001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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.sys.batch;
017    
018    import java.util.Date;
019    
020    public interface Step {
021        /**
022         * Perform this step of a batch job.
023         * 
024         * @param jobName the name of the job running the step
025         * @param jobRunDate the time/date the job is executed
026         * @return true if successful and continue the job, false if successful and stop the job
027         * @throws Throwable if unsuccessful
028         */
029        public boolean execute(String jobName, Date jobRunDate) throws InterruptedException;
030    
031        /**
032         * Return id of this step spring bean.
033         * 
034         * @return The name of this step.
035         */
036        public String getName();
037    
038        /**
039         * Call to attempt to interrupt a step in the middle of processing. Note that this only has an effect if the step in question
040         * checks its interrupted status.
041         */
042        public void interrupt();
043    
044        public boolean isInterrupted();
045    
046        public void setInterrupted(boolean interrupted);
047    }