org.edg.security.authorization.map
Class AttributeMapFactory

java.lang.Object
  |
  +--org.edg.security.authorization.map.AttributeMapFactory

public class AttributeMapFactory
extends java.lang.Object

AttributeMapFactory Creates a Map from an XML snippet.

 <map name="name" type="type" modify="boolean" >  -- the supplied "config" node
   <!-- type specific data -->
 </map>
 
The factory uses MapCreators, of which there are a set in this package. NOTE: If the "name" attribute is set, and another Map instance with the same "name" has already been created, that Map will be returned instead. NO CONSISTENCY CHECKS ARE PERFORMED to verify whether the two configurations actually would produce identical maps.

Version:
%I%, %G%
Author:
Olle Mulmo
See Also:
AttributeMapCreator, TableMapCreator (type = table), FileMapCreator (type = file), DbMapCreator (type = db), CachedMapCreator (type = cached), RegexMapCreator (type = regex)

Field Summary
protected  java.util.Hashtable theCreatedMaps
          Hashtable storing the created maps with their name as lookup key
protected static java.util.Hashtable theMapCreators
          Hashtable storing the String->Class mappings type -> AttributeMapCreator
static java.lang.String theMapElement
           
static java.lang.String theModifyAttribute
           
static java.lang.String theNameAttribute
           
static java.lang.String theTypeAttribute
           
 
Constructor Summary
AttributeMapFactory()
           
 
Method Summary
 AttributeMap getMap(org.w3c.dom.Element config)
          Method getMap.
 AttributeMap getMap(java.lang.String name)
           
 java.util.List getMapNames()
           
 java.util.List getMaps(org.w3c.dom.Element config)
          Method getMaps.
 java.util.List getMaps(java.io.File configFile)
          Convenience method, loading all maps defined inside the root element of the supplied config file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theMapElement

public static final java.lang.String theMapElement
See Also:
Constant Field Values

theTypeAttribute

public static final java.lang.String theTypeAttribute
See Also:
Constant Field Values

theNameAttribute

public static final java.lang.String theNameAttribute
See Also:
Constant Field Values

theModifyAttribute

public static final java.lang.String theModifyAttribute
See Also:
Constant Field Values

theMapCreators

protected static java.util.Hashtable theMapCreators
Hashtable storing the String->Class mappings type -> AttributeMapCreator


theCreatedMaps

protected java.util.Hashtable theCreatedMaps
Hashtable storing the created maps with their name as lookup key

Constructor Detail

AttributeMapFactory

public AttributeMapFactory()
Method Detail

getMapNames

public java.util.List getMapNames()
Returns:
List of names of previously created maps

getMap

public AttributeMap getMap(java.lang.String name)
Parameters:
name - The name of a previously configured map
Returns:
Map The map in question, or null

getMap

public AttributeMap getMap(org.w3c.dom.Element config)
                    throws java.lang.Exception
Method getMap. Creates a map for each 'map' element defined in the supplied XML configuration.

Parameters:
config - The given configuration, containing 'map' element(s)
Returns:
AttributeMap The newly created map
Throws:
java.lang.Exception - if the map could not be created

getMaps

public java.util.List getMaps(org.w3c.dom.Element config)
                       throws java.lang.Exception
Method getMaps. Creates a list of maps for each 'map' element defined in the configuration

Parameters:
config - The given configuration, containing 'map' children nodes
Returns:
List of Map
Throws:
java.lang.Exception - if one of the 'map' elements cannot be created

getMaps

public java.util.List getMaps(java.io.File configFile)
                       throws java.lang.Exception
Convenience method, loading all maps defined inside the root element of the supplied config file.

java.lang.Exception
See Also:
getMaps(Element)