KickJava   Java API By Example, From Geeks To Geeks.

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


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.Collection JavaDoc;
19 import java.util.Map JavaDoc;
20
21 /**
22  * A class to manage the types of creators and the instansiated creators.
23  * @author Joe Walker [joe at getahead dot ltd dot uk]
24  */

25 public interface CreatorManager
26 {
27     /**
28      * Debug mode allows access to the list of creator names
29      * @return Are we in debug mode
30      * @see CreatorManager#getCreatorNames()
31      */

32     boolean isDebug();
33
34     /**
35      * In init mode, add a new type of creator
36      * @param id The name of the new creator type
37      * @param className The class that we create
38      */

39     void addCreatorType(String JavaDoc id, String JavaDoc className);
40
41     /**
42      * Add a new creator
43      * @param scriptName The name of the creator to Javascript
44      * @param typename The class to use as a creator
45      * @param params The extra parameters to allow the creator to configure itself
46      * @throws InstantiationException If reflection based creation fails
47      * @throws IllegalAccessException If reflection based creation fails
48      * @throws IllegalArgumentException If we have a duplicate name
49      */

50     void addCreator(String JavaDoc scriptName, String JavaDoc typename, Map JavaDoc params) throws InstantiationException JavaDoc, IllegalAccessException JavaDoc, IllegalArgumentException JavaDoc;
51
52     /**
53      * Add a new creator
54      * @param scriptName The name of the creator to Javascript
55      * @param creator The creator to add
56      * @throws IllegalArgumentException If we have a duplicate name
57      */

58     void addCreator(String JavaDoc scriptName, Creator creator) throws IllegalArgumentException JavaDoc;
59
60     /**
61      * Get a list of the javascript names of the allowed creators.
62      * This method could be seen as a security risk because it could allow an
63      * attacker to find out extra information about your system so it is only
64      * available if debug is turned on.
65      * @return Loop over all the known allowed classes
66      * @throws SecurityException If we are not in debug mode
67      */

68     Collection JavaDoc getCreatorNames() throws SecurityException JavaDoc;
69
70     /**
71      * Find an <code>Creator</code> by name
72      * @param scriptName The name of the creator to Javascript
73      * @return The found Creator instance, or null if none was found.
74      * @throws SecurityException If the Creator is not known
75      */

76     Creator getCreator(String JavaDoc scriptName) throws SecurityException JavaDoc;
77
78     /**
79      * Sets the creators for this creator manager.
80      * @param creators the map of managed beans and their creator instances
81      */

82     void setCreators(Map JavaDoc creators);
83 }
84
Popular Tags