public class BaseAttributeFactory extends AttributeFactory
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.
| Constructor and Description |
|---|
BaseAttributeFactory()
Default constructor.
|
BaseAttributeFactory(Map attributes)
Constructor that configures this factory with an initial set of supported datatypes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDatatype(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(Node root)
Creates a value based on the given DOM root node.
|
AttributeValue |
createValue(Node root,
String type)
Creates a value based on the given DOM root node and data type.
|
AttributeValue |
createValue(Node root,
URI dataType)
Creates a value based on the given DOM root node and data type.
|
AttributeValue |
createValue(URI dataType,
String value,
String[] params)
Creates a value based on the given data type and text-encoded value.
|
Set |
getSupportedDatatypes()
Returns the datatype identifiers supported by this factory.
|
createValue, getInstance, getInstance, registerFactory, setDefaultFactorypublic BaseAttributeFactory()
public BaseAttributeFactory(Map attributes)
attributes - a Map of Strings to AttributeProxysIllegalArgumentException - if any elements of the Map are not
AttributeProxyspublic void addDatatype(String id, AttributeProxy proxy)
AttributeValue class.addDatatype in class AttributeFactoryid - the name of the attribute typeproxy - the proxy used to create new attributes of the given typepublic Set getSupportedDatatypes()
getSupportedDatatypes in class AttributeFactorySet of Stringspublic AttributeValue createValue(Node root) throws UnknownIdentifierException, ParsingException
DataType, as is the case with
the AttributeValueType in the policy schema. The value is assumed to be the first child of
this node.createValue in class AttributeFactoryroot - the DOM root of an attribute valueAttributeValueUnknownIdentifierException - if the type in the node isn't known to the factoryParsingException - if the node is invalid or can't be parsed by the appropriate proxypublic AttributeValue createValue(Node root, URI dataType) throws UnknownIdentifierException, ParsingException
createValue in class AttributeFactoryroot - the DOM root of an attribute valuedataType - the type of the attributeAttributeValueUnknownIdentifierException - if the data type isn't known to the factoryParsingException - if the node is invalid or can't be parsed by the appropriate proxypublic AttributeValue createValue(Node root, String type) throws UnknownIdentifierException, ParsingException
createValue in class AttributeFactoryroot - the DOM root of an attribute valuetype - the type of the attributeAttributeValueUnknownIdentifierException - if the type isn't known to the factoryParsingException - if the node is invalid or can't be parsed by the appropriate proxypublic AttributeValue createValue(URI dataType, String value, String[] params) throws UnknownIdentifierException, ParsingException
createValue in class AttributeFactorydataType - the type of the attributevalue - the text-encoded representation of an attribute's valueparams - additional parameters that need to creates a valueAttributeValueUnknownIdentifierException - if the data type isn't known to the factoryParsingException - if the text is invalid or can't be parsed by the appropriate proxyCopyright © 2018 WSO2. All rights reserved.