1 /*
2 * Copyright 2004-2008 the Seasar Foundation and the Others.
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,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.seasar.uruma.jobs;
17
18 /**
19 * ジョブの進捗を通知するためのインタフェースです。<br />
20 *
21 * @author y-komori
22 */
23 public interface ProgressMonitor {
24 /**
25 * ジョブの総量が不明であることを示す定数です。<br />
26 */
27 public final static int UNKNOWN = -1;
28
29 /**
30 * メインタスクの開始を通知します。<br />
31 *
32 * @param name
33 * メインタスクの名称
34 * @param totalWork
35 * メインタスクの総量。値が <code>UNKNOWN</code> の場合、総量が不明であることを示します。
36 */
37 public void beginTask(String name, int totalWork);
38
39 /**
40 * メインタスクの終了を通知します。<br />
41 */
42 public void done();
43
44 /**
45 * タスクがキャンセルされたかどうかを返します。<br />
46 *
47 * @return タスクがキャンセルされた場合、<code>true</code>。そうでない場合は <code>false</code>。
48 * @see #setCanceled(boolean)
49 */
50 public boolean isCanceled();
51
52 /**
53 * キャンセル状態を設定します。<br />
54 *
55 * @param value
56 * キャンセルが要求されている場合、<code>true</code>。そうでない場合、
57 * <code>false</code>。
58 * @see #isCanceled()
59 */
60 public void setCanceled(boolean value);
61
62 /**
63 * タスク名称を設定します。<br />
64 *
65 * @param name
66 * タスク名称
67 * @see #beginTask(java.lang.String, int)
68 */
69 public void setTaskName(String name);
70
71 /**
72 * サブタスクの開始を通知します。<br />
73 * サブタスクの利用はオプションですので、必ずしも利用する必要はありません。
74 *
75 * @param name
76 * サブタスクの名称
77 */
78 public void subTask(String name);
79
80 /**
81 * 指定された値を、タスクの完了値として通知します。<br />
82 *
83 * @param work
84 * 完了したタスク量。(負でない整数)
85 */
86 public void worked(int work);
87
88 }