Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sun.xacml.attr
Class BaseAttributeFactory  view BaseAttributeFactory download BaseAttributeFactory.java

java.lang.Object
  extended bycom.sun.xacml.attr.AttributeFactory
      extended bycom.sun.xacml.attr.BaseAttributeFactory
Direct Known Subclasses:
StandardAttributeFactory

public class BaseAttributeFactory
extends AttributeFactory

This is a basic implementation of AttributeFactory. It implements the insertion and retrieval methods, but doesn't actually setup the factory with any datatypes.

Note that while this class is thread-safe on all creation methods, it is not safe to add support for a new datatype while creating an instance of a value. This follows from the assumption that most people will initialize these factories up-front, and then start processing without ever modifying the factories. If you need these mutual operations to be thread-safe, then you should write a wrapper class that implements the right synchronization.

Since:
1.2

Field Summary
private  java.util.HashMap attributeMap
           
 
Fields inherited from class com.sun.xacml.attr.AttributeFactory
 
Constructor Summary
BaseAttributeFactory()
          Default constructor.
BaseAttributeFactory(java.util.Map attributes)
          Constructor that configures this factory with an initial set of supported datatypes.
 
Method Summary
 void addDatatype(java.lang.String id, AttributeProxy proxy)
          Adds a proxy to the factory, which in turn will allow new attribute types to be created using the factory.
 AttributeValue createValue(org.w3c.dom.Node root)
          Creates a value based on the given DOM root node.
 AttributeValue createValue(org.w3c.dom.Node root, java.lang.String type)
          Creates a value based on the given DOM root node and data type.
 AttributeValue createValue(org.w3c.dom.Node root, java.net.URI dataType)
          Creates a value based on the given DOM root node and data type.
 AttributeValue createValue(java.net.URI dataType, java.lang.String value)
          Creates a value based on the given data type and text-encoded value.
 java.util.Set getSupportedDatatypes()
          Returns the datatype identifiers supported by this factory.
 
Methods inherited from class com.sun.xacml.attr.AttributeFactory
addAttributeProxy, createAttribute, createAttribute, createAttribute, createAttribute, getInstance, setDefaultFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeMap

private java.util.HashMap attributeMap
Constructor Detail

BaseAttributeFactory

public BaseAttributeFactory()
Default constructor.


BaseAttributeFactory

public BaseAttributeFactory(java.util.Map attributes)
Constructor that configures this factory with an initial set of supported datatypes.

Method Detail

addDatatype

public void addDatatype(java.lang.String id,
                        AttributeProxy proxy)
Adds a proxy to the factory, which in turn will allow new attribute types to be created using the factory. Typically the proxy is provided as an anonymous class that simply calls the getInstance methods (or something similar) of some AttributeValue class.

Specified by:
addDatatype in class AttributeFactory

getSupportedDatatypes

public java.util.Set getSupportedDatatypes()
Returns the datatype identifiers supported by this factory.

Specified by:
getSupportedDatatypes in class AttributeFactory

createValue

public AttributeValue createValue(org.w3c.dom.Node root)
                           throws com.sun.xacml.UnknownIdentifierException,
                                  com.sun.xacml.ParsingException
Creates a value based on the given DOM root node. The type of the attribute is assumed to be present in the node as an XACML attribute named DataType, as is the case with the AttributeValueType in the policy schema. The value is assumed to be the first child of this node.

Specified by:
createValue in class AttributeFactory

createValue

public AttributeValue createValue(org.w3c.dom.Node root,
                                  java.net.URI dataType)
                           throws com.sun.xacml.UnknownIdentifierException,
                                  com.sun.xacml.ParsingException
Creates a value based on the given DOM root node and data type.

Specified by:
createValue in class AttributeFactory

createValue

public AttributeValue createValue(org.w3c.dom.Node root,
                                  java.lang.String type)
                           throws com.sun.xacml.UnknownIdentifierException,
                                  com.sun.xacml.ParsingException
Creates a value based on the given DOM root node and data type.

Specified by:
createValue in class AttributeFactory

createValue

public AttributeValue createValue(java.net.URI dataType,
                                  java.lang.String value)
                           throws com.sun.xacml.UnknownIdentifierException,
                                  com.sun.xacml.ParsingException
Creates a value based on the given data type and text-encoded value. Used primarily by code that does an XPath query to get an attribute value, and then needs to turn the resulting value into an Attribute class.

Specified by:
createValue in class AttributeFactory