org.jboss.security.xacml.sunxacml.attr
Class StandardAttributeFactory

java.lang.Object
  extended by org.jboss.security.xacml.sunxacml.attr.AttributeFactory
      extended by org.jboss.security.xacml.sunxacml.attr.BaseAttributeFactory
          extended by org.jboss.security.xacml.sunxacml.attr.StandardAttributeFactory

public class StandardAttributeFactory
extends BaseAttributeFactory

This factory supports the standard set of datatypes specified in XACML 1.x and 2.0. It is the default factory used by the system, and imposes a singleton pattern insuring that there is only ever one instance of this class.

Note that because this supports only the standard datatypes, this factory does not allow the addition of any other datatypes. If you call addDatatype on an instance of this class, an exception will be thrown. If you need a standard factory that is modifiable, you should create a new BaseAttributeFactory (or some other AttributeFactory) and configure it with the standard datatypes using addStandardDatatypes (or, in the case of BaseAttributeFactory, by providing the datatypes in the constructor).

Since:
1.2
Author:
Seth Proctor

Method Summary
 void addDatatype(String id, AttributeProxy proxy)
          Throws an UnsupportedOperationException since you are not allowed to modify what a standard factory supports.
static StandardAttributeFactory getFactory()
          Returns an instance of this factory.
static AttributeFactory getNewFactory()
          A convenience method that returns a new instance of an that supports all of the standard datatypes.
static Set getStandardDatatypes(String xacmlVersion)
          Returns the identifiers supported for the given version of XACML.
 
Methods inherited from class org.jboss.security.xacml.sunxacml.attr.BaseAttributeFactory
createValue, createValue, createValue, createValue, getSupportedDatatypes
 
Methods inherited from class org.jboss.security.xacml.sunxacml.attr.AttributeFactory
addAttributeProxy, createAttribute, createAttribute, createAttribute, createAttribute, getInstance, getInstance, registerFactory, setDefaultFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFactory

public static StandardAttributeFactory getFactory()
Returns an instance of this factory. This method enforces a singleton model, meaning that this always returns the same instance, creating the factory if it hasn't been requested before. This is the default model used by the AttributeFactory, ensuring quick access to this factory.

Returns:
the factory instance

getNewFactory

public static AttributeFactory getNewFactory()
A convenience method that returns a new instance of an that supports all of the standard datatypes. The new factory allows adding support for new datatypes. This method should only be used when you need a new, mutable instance (eg, when you want to create a new factory that extends the set of supported datatypes). In general, you should use getFactory which is more efficient and enforces a singleton pattern.

Returns:
a new factory supporting the standard datatypes

getStandardDatatypes

public static Set getStandardDatatypes(String xacmlVersion)
                                throws UnknownIdentifierException
Returns the identifiers supported for the given version of XACML. Because this factory supports identifiers from all versions of the XACML specifications, this method is useful for getting a list of which specific identifiers are supported by a given version of XACML.

Parameters:
xacmlVersion - a standard XACML identifier string, as provided in PolicyMetaData
Returns:
a Set of identifiers
Throws:
UnknownIdentifierException - if the version string is unknown

addDatatype

public void addDatatype(String id,
                        AttributeProxy proxy)
Throws an UnsupportedOperationException since you are not allowed to modify what a standard factory supports.

Overrides:
addDatatype in class BaseAttributeFactory
Parameters:
id - the name of the attribute type
proxy - the proxy used to create new attributes of the given type
Throws:
UnsupportedOperationException - always


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