KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > core > event > LongRunning


1 /*
2  * Copyright (C) 2003 Christian Cryder [christianc@granitepeaks.com]
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * $Id: LongRunning.java,v 1.2 2004/02/01 05:16:28 christianc Exp $
19  */

20 package org.enhydra.barracuda.core.event;
21
22 import java.io.*;
23 import java.math.*;
24 import java.util.*;
25
26 import org.enhydra.barracuda.plankton.data.*;
27
28 /**
29  * This interface indicates an EventHandler takes a long time to run. As such,
30  * Barracuda will automatically send a response back to the browser giving the
31  * user the opportunity to a) see that its going to take a while and b) interrupt
32  * the process if they so choose.
33  *
34  * @author christianc@granitepeaks.com
35  * @since 010404_1
36  */

37 public interface LongRunning {
38
39     /**
40      * Specify the redirect event to be fired if the LongRunning process is cancelled
41      */

42     public void setRedirectEvent(BaseEvent be);
43     
44     /**
45      * get the redirect event for this LongRunning process. Typically called by LongRunningEventGateway.
46      */

47     public BaseEvent getRedirectEvent();
48     
49     /**
50      * set the refresh rate (in secs). -1 indicates the DEFAULT_REFRESH_RATE will be used
51      */

52     public void setRefreshRate(int secs);
53     
54     /**
55      * get the refresh rate (in secs). If the refresh rate has not been set,
56      * DEFAULT_REFRESH_RATE will be returned.
57      */

58     public int getRefreshRate();
59
60     /**
61      * set ETA (in secs). -1 indicates the DEFAULT_ETA will be used
62      */

63     public void setETA(int secs);
64     
65     /**
66      * get ETA (in secs). If the ETA has not been set, DEFAULT_ETA will be returned.
67      */

68     public int getETA();
69     
70     /**
71      * set elapsed (in secs). This can be called by the developer's event handler code if desired
72      * to manually specify how much time has elapsed. If you don't call this method, elapsed time
73      * be determined dynamically by comparing the amount of time elapsed from object creation.
74      */

75     public void setElapsed(int secs);
76     
77     /**
78      * get elapsed (in secs). If a elapsed time has not been programatically specified,
79      * it will be calulated dynamically. Typically called by LongRunningEventGateway.
80      */

81     public int getElapsed();
82
83     /**
84      * set the percent complete (int between 0 and 100). This can be called by the developer's event
85      * handler code if desired to manually specify completion percent. If you don't call this method,
86      * percent completed will be determined dynamically by comparing the amount of time elapsed with ETA.
87      */

88     public void setPercentComplete(int percent);
89     
90     /**
91      * get the percent complete (int between 0 and 100). If a percentage complete has not been
92      * programatically specified, it will be calulated dynamically. Typically called by
93      * LongRunningEventGateway.
94      */

95     public int getPercentComplete();
96
97     /**
98      * get the statemap (may be used for storing key/val info, which can then
99      * be retrieved from the template). Typically called by the developer's event handling code to
100      * set some kind of value, and then by LongRunningEventGateway to retrieve that value when
101      * requested by the template.
102      */

103     public StateMap getStateMap();
104
105     /**
106      * provide a List of additional BTemplate models to make available during to the
107      * LongRunningEventGateway template. This method would be called by the developers event
108      * handler code to provide additional models for the template to access.
109      */

110     public void setAdditionalModels(List imodels);
111
112     /**
113      * get any additional BTemplate models. Typically called by LongRunningEventGateway.
114      */

115     public List getAdditionalModels();
116
117     /**
118      * provide a different Template class instead of the default Barracuda template, This
119      * will typically be used by developers who want to override L&F of the progress screen.
120      */

121     public void setTemplateClass(Class JavaDoc cl);
122
123     /**
124      * get the custom template class. Typically called by LongRunningEventGateway.
125      */

126     public Class JavaDoc getTemplateClass();
127     
128     /**
129      * resets the start time. Typically called by ApplicationGateway prior to dispatching.
130      */

131     public void reset();
132     
133 }
134
Popular Tags