Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/javahispano/canyamo/core/action/Action.java


1   /*
2       Caņamo, portal framework
3       Copyright (c) 2002
4       Alberto Molpeceres, javaHispano (http://www.javahispano.org)
5       All rights reserved.
6       .
7       Redistribution and use in source and binary forms, with or without
8       modification, are permitted provided that the following conditions are met:
9       Redistributions of source code must retain the above copyright notice,
10      this list of conditions and the following disclaimer.
11      Redistributions in binary form must reproduce the above copyright notice,
12      this list of conditions and the following disclaimer in the documentation
13      and/or other materials provided with the distribution.
14      Neither the name of Alberto Molpeceres, javaHispano nor the names of its
15      contributors may be used to endorse or promote products derived from
16      this software without specific prior written permission.
17      .
18      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20      THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21      PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
22      LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23      OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24      SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25      INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26      IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28      THE POSSIBILITY OF SUCH DAMAGE.
29    */
30  package org.javahispano.canyamo.core.action;
31  
32  import org.javahispano.canyamo.core.*;
33  import org.javahispano.canyamo.core.application.*;
34  import java.util.*;
35  
36  /**
37   *  Interface that should implement all actions to be managed by Canyamo. <br>
38   *  <br>
39   *  An action is a "process" that Canyamo can execute in response to an User
40   *  request. <br>
41   *  Actions should manipulated the data in order to satisfied User's request,
42   *  and put data related to the response in <code>WorkData</code>, which will be
43   *  passed to the associated <code>Displayer</code>, which would render the
44   *  response in HTML form.
45   *
46   *@author     <a href="mailto:al AT javahispano DOT org">Alberto Molpeceres</a>
47   *@created    10. September 2002
48   *@version
49   */
50  public interface Action {
51    /**
52     *  Process of User's request.
53     *
54     *@param  data                  Encapsulated request data
55     *@exception  CanyamoException  Description of Exception
56     */
57    public void process(WorkData data)
58      throws CanyamoException;
59  
60  
61    /**  Initilizes Action if necessary */
62    public void init();
63  
64  
65    /**
66     *  Action name as string
67     *
68     *@return    Action's name
69     */
70    public String getName();
71  
72  
73    /**
74     *  Sets Action's name
75     *
76     *@param  name  name
77     */
78    public void setName(String name);
79  
80  
81    /**
82     *  Adds a configuration property to the action <br>
83     *  <br>
84     *
85     *
86     *@param  name   Name of the property
87     *@param  value  Value of the property
88     */
89    public void addProperty(String name, String value);
90  
91  
92    /**
93     *  Sets the <code>Displayer</code> associated with this Action
94     *
95     *@param  displayer  name of the displayer
96     */
97    public void setDisplayer(String displayer);
98  
99  
100   /**
101    *  Gets the <code>Displayer</code> associated to this action
102    *
103    *@return    displayer's name
104    */
105   public String getDisplayer();
106 
107 
108   /**
109    *  Returns a descriptive text of the action
110    *
111    *@return    description text
112    */
113   public String getDescription();
114 
115 
116 
117   /**
118    *  Adds a <code>Displayer</code> as Listener for this Action <br>
119    *  <br>
120    *  This should be used in the case that some displayers do some kind of
121    *  content caching.
122    *
123    *@param  listener  Listener to be added
124    */
125   public void addActionListener(ActionListener listener);
126 
127 
128   /**  Notifies all listeners that the Action has been executed */
129   public void fireActionEvent();
130 
131 
132   /**
133    *  Sets the <code>Application</code> to which this action belong to
134    *
135    *@param  app  action's application
136    */
137   public void setApplication(Application app);
138 
139 
140   /**
141    *  Gets the <code>Application</code> to which this action belong to
142    *
143    *@return    action's application
144    */
145   public Application getApplication();
146 
147 
148   /**
149    *  Gets an statistic value of this Action. <br>
150    *  Normally it's a count of values or a count values in "to do" for admin
151    *  actions
152    *
153    *@return    The statistic value
154    */
155   public int getStatistic();
156 
157 }
158 
159