uk.ltd.getahead.dwr.impl
Class DefaultCreatorManager

java.lang.Object
  extended byuk.ltd.getahead.dwr.impl.DefaultCreatorManager
All Implemented Interfaces:
CreatorManager

public class DefaultCreatorManager
extends java.lang.Object
implements CreatorManager

A class to manage the types of creators and the instansiated creators.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
DefaultCreatorManager()
           
 
Method Summary
 void addCreator(java.lang.String scriptName, Creator creator)
          Add a new creator
 void addCreator(java.lang.String typeName, java.lang.String scriptName, java.util.Map params)
          Add a new creator
 void addCreatorType(java.lang.String typeName, java.lang.Class clazz)
          In init mode, add a new type of creator
 Creator getCreator(java.lang.String scriptName)
          Find an Creator by name
 java.util.Collection getCreatorNames()
          Get a list of the javascript names of the allowed creators.
 boolean isDebug()
          Debug mode allows access to the list of creator names
 void setCreators(java.util.Map creators)
          Sets the creators for this creator manager.
 void setDebug(boolean debug)
          Set the debug status
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCreatorManager

public DefaultCreatorManager()
Method Detail

setDebug

public void setDebug(boolean debug)
Set the debug status

Parameters:
debug - The new debug setting

isDebug

public boolean isDebug()
Description copied from interface: CreatorManager
Debug mode allows access to the list of creator names

Specified by:
isDebug in interface CreatorManager
Returns:
Are we in debug mode
See Also:
CreatorManager.getCreatorNames()

addCreatorType

public void addCreatorType(java.lang.String typeName,
                           java.lang.Class clazz)
Description copied from interface: CreatorManager
In init mode, add a new type of creator

Specified by:
addCreatorType in interface CreatorManager
Parameters:
typeName - The name of the new creator type
clazz - The class that we create

addCreator

public void addCreator(java.lang.String typeName,
                       java.lang.String scriptName,
                       java.util.Map params)
                throws java.lang.InstantiationException,
                       java.lang.IllegalAccessException,
                       java.lang.IllegalArgumentException
Description copied from interface: CreatorManager
Add a new creator

Specified by:
addCreator in interface CreatorManager
Parameters:
typeName - The class to use as a creator
scriptName - The name of the creator to Javascript
params - The extra parameters to allow the creator to configure itself
Throws:
java.lang.InstantiationException - If reflection based creation fails
java.lang.IllegalArgumentException - If we have a duplicate name
java.lang.IllegalAccessException - If reflection based creation fails

addCreator

public void addCreator(java.lang.String scriptName,
                       Creator creator)
                throws java.lang.IllegalArgumentException
Description copied from interface: CreatorManager
Add a new creator

Specified by:
addCreator in interface CreatorManager
Parameters:
scriptName - The name of the creator to Javascript
creator - The creator to add
Throws:
java.lang.IllegalArgumentException - If we have a duplicate name

getCreatorNames

public java.util.Collection getCreatorNames()
                                     throws java.lang.SecurityException
Description copied from interface: CreatorManager
Get a list of the javascript names of the allowed creators. This method could be seen as a security risk because it could allow an attacker to find out extra information about your system so it is only available if debug is turned on.

Specified by:
getCreatorNames in interface CreatorManager
Returns:
Loop over all the known allowed classes
Throws:
java.lang.SecurityException - If we are not in debug mode

getCreator

public Creator getCreator(java.lang.String scriptName)
                   throws java.lang.SecurityException
Description copied from interface: CreatorManager
Find an Creator by name

Specified by:
getCreator in interface CreatorManager
Parameters:
scriptName - The name of the creator to Javascript
Returns:
The found Creator instance, or null if none was found.
Throws:
java.lang.SecurityException - If the Creator is not known

setCreators

public void setCreators(java.util.Map creators)
Description copied from interface: CreatorManager
Sets the creators for this creator manager.

Specified by:
setCreators in interface CreatorManager
Parameters:
creators - the map of managed beans and their creator instances

Copyright ? 2005