KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > directwebremoting > extend > Creator


1 /*
2  * Copyright 2005 Joe Walker
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, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.directwebremoting.extend;
17
18 import java.util.Map JavaDoc;
19
20 /**
21  * A base class for all AllowedClasses
22  * @author Joe Walker [joe at getahead dot ltd dot uk]
23  */

24 public interface Creator
25 {
26     /**
27      * DefaultConfiguration is done via access to the DOM Element.
28      * This is not at all ideal, but it will do for the moment.
29      * @param params The map of paramters to configure the creator
30      * @throws IllegalArgumentException If the config data in the Element is invalid
31      */

32     void setProperties(Map JavaDoc params) throws IllegalArgumentException JavaDoc;
33
34     /**
35      * Accessor for the <code>java.lang.Class</code> that this Creator
36      * allows access to.
37      * @return The type of this allowed class
38      */

39     Class JavaDoc getType();
40
41     /**
42      * Accessor for the/an instance of this Creator.
43      * @return the instance to use
44      * @throws InstantiationException If for some reason the object can not be created
45      */

46     Object JavaDoc getInstance() throws InstantiationException JavaDoc;
47
48     /**
49      * Each Creator creates objects with a given scope.
50      * @return How long do we hold onto instances created by this Creator
51      */

52     String JavaDoc getScope();
53
54     /**
55      * Is the class behind the Creator likely to change over time?
56      * @return Returns the reloadable variable
57      */

58     boolean isCacheable();
59
60     /**
61      * How is this creator refered to in Javascript land?
62      * @return A Javascript identifier
63      */

64     String JavaDoc getJavascript();
65
66     /**
67      * Application scope: named reference remains available in the
68      * ServletContext until it is reclaimed.
69      */

70     static final String JavaDoc APPLICATION = "application";
71
72     /**
73      * Session scope (only valid if this page participates in a session): the
74      * named reference remains available from the HttpSession (if any)
75      * associated with the Servlet until the HttpSession is invalidated.
76      */

77     static final String JavaDoc SESSION = "session";
78
79     /**
80      * Script scope (tied to a id recorded in Javascript): the named reference
81      * remains available while the script variable remains stored in the
82      * browser.
83      */

84     static final String JavaDoc SCRIPT = "script";
85
86     /**
87      * Request scope: the named reference remains available from the
88      * ServletRequest associated with the Servlet until the current request is
89      * completed. This scope type is almost identical to {@link #PAGE} scope
90      * and it is recommended to use {@link #PAGE} scope in place of this scope.
91      * Use of {@value #REQUEST} may be deprecated in the future.
92      */

93     static final String JavaDoc REQUEST = "request";
94
95     /**
96      * Page scope: (this is the default) the named reference remains available
97      * in this PageContext until the return from the current Servlet.service()
98      * invocation.
99      */

100     static final String JavaDoc PAGE = "page";
101 }
102
Popular Tags