Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DialogContextListener |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | package org.apache.shale.dialog; | |
19 | ||
20 | ||
21 | /** | |
22 | * <p>JavaBeans listener for a single instance of a Shale dialog.</p> | |
23 | * | |
24 | * <p><strong>IMPLEMENTATION NOTE</strong> - Implementations of this interface | |
25 | * will be stored in session scope, so they should be serializable.</p> | |
26 | * | |
27 | * @since 1.0.4 | |
28 | */ | |
29 | public interface DialogContextListener { | |
30 | ||
31 | ||
32 | //----------------------------------------------- Coarse grained callbacks | |
33 | ||
34 | /** | |
35 | * <p>Handle the starting of the dialog instance.</p> | |
36 | */ | |
37 | public void onStart(); | |
38 | ||
39 | ||
40 | /** | |
41 | * <p>Handle the stopping of the dialog instance.</p> | |
42 | */ | |
43 | public void onStop(); | |
44 | ||
45 | ||
46 | /** | |
47 | * <p>Handle an unexpected failure during the execution of this dialg | |
48 | * instance.</p> | |
49 | * | |
50 | * @param exception A potentially implementation specific exception | |
51 | * during the execution of this dialog instance | |
52 | */ | |
53 | public void onException(Exception exception); | |
54 | ||
55 | ||
56 | //------------------------------------------------- Fine grained callbacks | |
57 | ||
58 | /** | |
59 | * <p>Handle an entry into a dialog state.</p> | |
60 | * | |
61 | * @param stateId Implementation specific identifier of the state | |
62 | * that has been entered | |
63 | */ | |
64 | public void onEntry(String stateId); | |
65 | ||
66 | ||
67 | /** | |
68 | * <p>Handle an exit from a dialog state.</p> | |
69 | * | |
70 | * @param stateId Implementation specific identifier of the state | |
71 | * that has been exited | |
72 | */ | |
73 | public void onExit(String stateId); | |
74 | ||
75 | ||
76 | /** | |
77 | * <p>Handle a transition being followed.</p> | |
78 | * | |
79 | * @param fromStateId Implementation specific identifier of the source | |
80 | * state for the transition that has been followed | |
81 | * @param toStateId Implementation specific identifier of the target | |
82 | * state for the transition that has been followed | |
83 | */ | |
84 | public void onTransition(String fromStateId, String toStateId); | |
85 | ||
86 | ||
87 | //-------------------------------------------------------------- Ownership | |
88 | ||
89 | /** | |
90 | * <p>Return the {@link DialogContext} instance associated with this | |
91 | * {@link DialogContextListener}.</p> | |
92 | * | |
93 | * @return The {@link DialogContext} whose execution we are listening to | |
94 | */ | |
95 | public DialogContext getDialogContext(); | |
96 | ||
97 | ||
98 | /** | |
99 | * <p>Set the {@link DialogContext} instance associated with this | |
100 | * {@link DialogContextListener}.</p> | |
101 | * | |
102 | * @param dialogContext The {@link DialogContext} whose execution we | |
103 | * will track | |
104 | */ | |
105 | public void setDialogContext(DialogContext dialogContext); | |
106 | ||
107 | ||
108 | } |