org.edg.security.authorization
Class AuthorizationManagerFactory

java.lang.Object
  |
  +--org.edg.security.authorization.AuthorizationManagerFactory

public class AuthorizationManagerFactory
extends java.lang.Object

Factory for creating AuthorizationManager instances. An instance is created from a configuration described in an XML file. The factory may optionally register the newly created instances in a table, using as key an arbitrary string provided by the calling application. In this way several applications may share the same instance of AuthorizationManager, following this model: - one application creates an instance of AuthorizationManager and associates it with a given ID; - the remaining applications requires the instance of AuthorizationManager associated with the above given ID.

Version:
$Id
Author:
Gian Luca Volpato
See Also:
AuthorizationManager

Field Summary
protected static java.util.Hashtable myAuthorizationManagers
           
protected static org.apache.log4j.Logger myLogger
           
 
Constructor Summary
AuthorizationManagerFactory()
           
 
Method Summary
static AuthorizationManager createAuthorizationManager(java.lang.String configFile, java.lang.String elementTag, java.lang.String authzManagID)
          Method createAuthorizationManager Creates an AuthorizationManager according to the definition supplied in the section of the XML configuration file corresponing to the given element tag.
static AuthorizationManager getAuthorizationManager(java.lang.String authzManagID)
          Method getAuthorizationManager Returns the AuthorizationManager associated with the given identity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myLogger

protected static org.apache.log4j.Logger myLogger

myAuthorizationManagers

protected static java.util.Hashtable myAuthorizationManagers
Constructor Detail

AuthorizationManagerFactory

public AuthorizationManagerFactory()
Method Detail

getAuthorizationManager

public static AuthorizationManager getAuthorizationManager(java.lang.String authzManagID)
                                                    throws java.lang.Exception
Method getAuthorizationManager Returns the AuthorizationManager associated with the given identity.

Parameters:
authzManagID - The string associated with the AuthorizationManager instance in question.
Returns:
AuthorizationManager The AuthorizationManager associated to the given identity string.
Throws:
java.lang.Exception - If there is no association with the given identity.

createAuthorizationManager

public static AuthorizationManager createAuthorizationManager(java.lang.String configFile,
                                                              java.lang.String elementTag,
                                                              java.lang.String authzManagID)
                                                       throws java.lang.Exception
Method createAuthorizationManager Creates an AuthorizationManager according to the definition supplied in the section of the XML configuration file corresponing to the given element tag. If such an AuthorizationManager has already been built with the given identity, that AuthorizationManager is returned instead.

Parameters:
configFile - The name of the configuration file containing parameters to define the structure of the AuthorizationManager.
elementTag - XML tag that identifies the configuration section of the file. Default is null == the root element.
authzManagID - An arbitrary string to be associated with the AuthorizationManager instance in question. It may be null, in which case this instance is not registered in the collection of currently existing AuthorizationManagers.
Returns:
AuthorizationManager An instance of AuthorizationManager.
Throws:
java.lang.Exception - In case of errors in the parameters described in the configuration file.
See Also:
AuthorizationManager.AuthorizationManager(String,String).