11a37d047SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 31a37d047SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 41a37d047SAndrew Rist * or more contributor license agreements. See the NOTICE file 51a37d047SAndrew Rist * distributed with this work for additional information 61a37d047SAndrew Rist * regarding copyright ownership. The ASF licenses this file 71a37d047SAndrew Rist * to you under the Apache License, Version 2.0 (the 81a37d047SAndrew Rist * "License"); you may not use this file except in compliance 91a37d047SAndrew Rist * with the License. You may obtain a copy of the License at 101a37d047SAndrew Rist * 111a37d047SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 121a37d047SAndrew Rist * 131a37d047SAndrew Rist * Unless required by applicable law or agreed to in writing, 141a37d047SAndrew Rist * software distributed under the License is distributed on an 151a37d047SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 161a37d047SAndrew Rist * KIND, either express or implied. See the License for the 171a37d047SAndrew Rist * specific language governing permissions and limitations 181a37d047SAndrew Rist * under the License. 191a37d047SAndrew Rist * 201a37d047SAndrew Rist *************************************************************/ 211a37d047SAndrew Rist 221a37d047SAndrew Rist 23cdf0e10cSrcweir package com.sun.star.report; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import java.io.IOException; 26cdf0e10cSrcweir 27cdf0e10cSrcweir /** 28cdf0e10cSrcweir * This allows some simple job control. A job can be interrupted (or if it has 29cdf0e10cSrcweir * not yet been started, canceled), and the job status can be queried (scheduled, 30cdf0e10cSrcweir * running, finished). 31cdf0e10cSrcweir * 32cdf0e10cSrcweir * <table border="1"> 33cdf0e10cSrcweir * <tr> 34cdf0e10cSrcweir * <th>JobStatus</th><th>running</th><th>finished</th> 35cdf0e10cSrcweir * </tr> 36cdf0e10cSrcweir * <tr> 37cdf0e10cSrcweir * <td>Scheduled</td><td>false</td><td>false</td> 38cdf0e10cSrcweir * </tr> 39cdf0e10cSrcweir * <tr> 40cdf0e10cSrcweir * <td>Running</td><td>true</td><td>false</td> 41cdf0e10cSrcweir * </tr> 42cdf0e10cSrcweir * <tr> 43cdf0e10cSrcweir * <td>Finished</td><td>false</td><td>true</td> 44cdf0e10cSrcweir * </tr> 45cdf0e10cSrcweir * </table> 46cdf0e10cSrcweir * 47cdf0e10cSrcweir * @author Thomas Morgner 48cdf0e10cSrcweir */ 49cdf0e10cSrcweir public interface ReportJob 50cdf0e10cSrcweir { 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** 53cdf0e10cSrcweir * Although we might want to run the job as soon as it has been 54cdf0e10cSrcweir * created, sometimes it is wiser to let the user add some listeners 55cdf0e10cSrcweir * first. If we execute at once, the user either has to deal with 56*9f813b30Smseidel * threading code or won't receive any progress information in single 57cdf0e10cSrcweir * threaded environments. 58cdf0e10cSrcweir * @throws java.io.IOException 59cdf0e10cSrcweir * @throws ReportExecutionException 60cdf0e10cSrcweir */ execute()61cdf0e10cSrcweir void execute() 62cdf0e10cSrcweir throws ReportExecutionException, IOException; 63cdf0e10cSrcweir 64cdf0e10cSrcweir /** 65cdf0e10cSrcweir * Interrupt the job. 66cdf0e10cSrcweir */ interrupt()67cdf0e10cSrcweir void interrupt(); 68cdf0e10cSrcweir 69cdf0e10cSrcweir /** 70cdf0e10cSrcweir * Queries the jobs execution status. 71cdf0e10cSrcweir * 72cdf0e10cSrcweir * @return true, if the job is currently running, false otherwise. 73cdf0e10cSrcweir */ isRunning()74cdf0e10cSrcweir boolean isRunning(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** 77cdf0e10cSrcweir * Queries the jobs result status. 78cdf0e10cSrcweir * 79cdf0e10cSrcweir * @return true, if the job is finished (or has been interrupted), false 80cdf0e10cSrcweir * if the job waits for activation. 81cdf0e10cSrcweir */ isFinished()82cdf0e10cSrcweir boolean isFinished(); 83cdf0e10cSrcweir addProgressIndicator(JobProgressIndicator indicator)84cdf0e10cSrcweir void addProgressIndicator(JobProgressIndicator indicator); 85cdf0e10cSrcweir removeProgressIndicator(JobProgressIndicator indicator)86cdf0e10cSrcweir void removeProgressIndicator(JobProgressIndicator indicator); 87cdf0e10cSrcweir } 88