org.jboss.security.xacml.sunxacml.combine
Class CombiningAlgFactory

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.combine.CombiningAlgFactory
Direct Known Subclasses:
BaseCombiningAlgFactory

public abstract class CombiningAlgFactory
extends Object

Provides a factory mechanism for installing and retrieving combining algorithms.

Since:
1.0
Author:
Seth Proctor

Constructor Summary
protected CombiningAlgFactory()
          Default constructor.
 
Method Summary
abstract  void addAlgorithm(CombiningAlgorithm alg)
          Adds a combining algorithm to the factory.
static void addCombiningAlg(CombiningAlgorithm alg)
          Deprecated. As of version 1.2, replaced by addAlgorithm(CombiningAlgorithm). The new factory system requires you to get a factory instance and then call the non-static methods on that factory. The static versions of these methods have been left in for now, but are slower and will be removed in a future version.
abstract  CombiningAlgorithm createAlgorithm(URI algId)
          Tries to return the correct combinging algorithm based on the given algorithm ID.
static CombiningAlgorithm createCombiningAlg(URI algId)
          Deprecated. As of version 1.2, replaced by createAlgorithm(URI). The new factory system requires you to get a factory instance and then call the non-static methods on that factory. The static versions of these methods have been left in for now, but are slower and will be removed in a future version.
static CombiningAlgFactory getInstance()
          Returns the default factory.
static CombiningAlgFactory getInstance(String identifier)
          Returns a factory based on the given identifier.
abstract  Set getSupportedAlgorithms()
          Returns the algorithm identifiers supported by this factory.
static void registerFactory(String identifier, CombiningAlgFactoryProxy proxy)
          Registers the given factory proxy with the given identifier.
static void setDefaultFactory(CombiningAlgFactoryProxy proxy)
          Sets the default factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombiningAlgFactory

protected CombiningAlgFactory()
Default constructor. Used only by subclasses.

Method Detail

getInstance

public static final CombiningAlgFactory getInstance()
Returns the default factory. Depending on the default factory's implementation, this may return a singleton instance or new instances with each invokation.

Returns:
the default CombiningAlgFactory

getInstance

public static final CombiningAlgFactory getInstance(String identifier)
                                             throws UnknownIdentifierException
Returns a factory based on the given identifier. You may register as many factories as you like, and then retrieve them through this interface, but a factory may only be registered once using a given identifier. By default, the standard XACML 1.0 and 2.0 identifiers are regsietered to provide the standard factory.

Parameters:
identifier - the identifier for a factory
Returns:
a CombiningAlgFactory
Throws:
UnknownIdentifierException - if the given identifier isn't registered

setDefaultFactory

public static final void setDefaultFactory(CombiningAlgFactoryProxy proxy)
Sets the default factory. This does not register the factory proxy as an identifiable factory.

Parameters:
proxy - the CombiningAlgFactoryProxy to set as the new default factory proxy

registerFactory

public static final void registerFactory(String identifier,
                                         CombiningAlgFactoryProxy proxy)
                                  throws IllegalArgumentException
Registers the given factory proxy with the given identifier. If the identifier is already used, then this throws an exception. If the identifier is not already used, then it will always be bound to the given proxy.

Parameters:
identifier - the identifier for the proxy
proxy - the CombiningAlgFactoryProxy to register with the given identifier
Throws:
IllegalArgumentException - if the identifier is already used

addAlgorithm

public abstract void addAlgorithm(CombiningAlgorithm alg)
Adds a combining algorithm to the factory. This single instance will be returned to anyone who asks the factory for an algorithm with the id given here.

Parameters:
alg - the combining algorithm to add
Throws:
IllegalArgumentException - if the algorithm is already registered

addCombiningAlg

public static void addCombiningAlg(CombiningAlgorithm alg)
Deprecated. As of version 1.2, replaced by addAlgorithm(CombiningAlgorithm). The new factory system requires you to get a factory instance and then call the non-static methods on that factory. The static versions of these methods have been left in for now, but are slower and will be removed in a future version.

Adds a combining algorithm to the factory. This single instance will be returned to anyone who asks the factory for an algorithm with the id given here.

Parameters:
alg - the combining algorithm to add
Throws:
IllegalArgumentException - if the algorithm is already registered

getSupportedAlgorithms

public abstract Set getSupportedAlgorithms()
Returns the algorithm identifiers supported by this factory.

Returns:
a Set of Strings

createAlgorithm

public abstract CombiningAlgorithm createAlgorithm(URI algId)
                                            throws UnknownIdentifierException
Tries to return the correct combinging algorithm based on the given algorithm ID.

Parameters:
algId - the identifier by which the algorithm is known
Returns:
a combining algorithm
Throws:
UnknownIdentifierException - algId is unknown

createCombiningAlg

public static CombiningAlgorithm createCombiningAlg(URI algId)
                                             throws UnknownIdentifierException
Deprecated. As of version 1.2, replaced by createAlgorithm(URI). The new factory system requires you to get a factory instance and then call the non-static methods on that factory. The static versions of these methods have been left in for now, but are slower and will be removed in a future version.

Tries to return the correct combinging algorithm based on the given algorithm ID.

Parameters:
algId - the identifier by which the algorithm is known
Returns:
a combining algorithm
Throws:
UnknownIdentifierException - algId is unknown


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.