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

Quick Search    Search Deep

com.sun.xacml.cond
Class BaseFunctionFactory  view BaseFunctionFactory download BaseFunctionFactory.java

java.lang.Object
  extended bycom.sun.xacml.cond.FunctionFactory
      extended bycom.sun.xacml.cond.BaseFunctionFactory
Direct Known Subclasses:
StandardFunctionFactory

public class BaseFunctionFactory
extends FunctionFactory

This is a basic implementation of FunctionFactory. It implements the insertion and retrieval methods, but it doesn't actually setup the factory with any functions. It also assumes a certain model with regard to the different kinds of functions (Target, Condition, and General). For this reason, you may want to re-use this class, or you may want to extend FunctionFactory directly, if you're writing a new factory implementation.

Note that while this class is thread-safe on all creation methods, it is not safe to add support for a new function while creating an instance of a function. 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 functionMap
           
private  FunctionFactory superset
           
 
Fields inherited from class com.sun.xacml.cond.FunctionFactory
 
Constructor Summary
BaseFunctionFactory()
          Default constructor.
BaseFunctionFactory(FunctionFactory superset)
          Constructor that sets a "superset factory".
BaseFunctionFactory(FunctionFactory superset, java.util.Set supportedFunctions, java.util.Map supportedAbstractFunctions)
          Constructor that defines the initial functions supported by this factory and uses a superset factory.
BaseFunctionFactory(java.util.Set supportedFunctions, java.util.Map supportedAbstractFunctions)
          Constructor that defines the initial functions supported by this factory but doesn't use a superset factory.
 
Method Summary
 void addAbstractFunction(FunctionProxy proxy, java.net.URI identity)
          Adds the abstract function proxy to the factory.
 void addFunction(Function function)
          Adds the function to the factory.
 Function createAbstractFunction(java.lang.String identity, org.w3c.dom.Node root)
          Tries to get an instance of the specified abstract function.
 Function createAbstractFunction(java.lang.String identity, org.w3c.dom.Node root, java.lang.String xpathVersion)
          Tries to get an instance of the specified abstract function.
 Function createAbstractFunction(java.net.URI identity, org.w3c.dom.Node root)
          Tries to get an instance of the specified abstract function.
 Function createAbstractFunction(java.net.URI identity, org.w3c.dom.Node root, java.lang.String xpathVersion)
          Tries to get an instance of the specified abstract function.
 Function createFunction(java.lang.String identity)
          Tries to get an instance of the specified function.
 Function createFunction(java.net.URI identity)
          Tries to get an instance of the specified function.
 java.util.Set getSupportedFunctions()
          Returns the function identifiers supported by this factory.
 
Methods inherited from class com.sun.xacml.cond.FunctionFactory
addAbstractConditionFunction, addAbstractGeneralFunction, addAbstractTargetFunction, addConditionFunction, addGeneralFunction, addTargetFunction, getConditionInstance, getGeneralInstance, getTargetInstance, setDefaultFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

functionMap

private java.util.HashMap functionMap

superset

private FunctionFactory superset
Constructor Detail

BaseFunctionFactory

public BaseFunctionFactory()
Default constructor. No superset factory is used.


BaseFunctionFactory

public BaseFunctionFactory(FunctionFactory superset)
Constructor that sets a "superset factory". This is useful since the different function factories (Target, Condition, and General) have a superset relationship (Condition functions are a superset of Target functions, etc.). Adding a function to this factory will automatically add the same function to the superset factory.


BaseFunctionFactory

public BaseFunctionFactory(java.util.Set supportedFunctions,
                           java.util.Map supportedAbstractFunctions)
Constructor that defines the initial functions supported by this factory but doesn't use a superset factory.


BaseFunctionFactory

public BaseFunctionFactory(FunctionFactory superset,
                           java.util.Set supportedFunctions,
                           java.util.Map supportedAbstractFunctions)
Constructor that defines the initial functions supported by this factory and uses a superset factory. Note that the functions supplied here are not propagated up to the superset factory, so you must either make sure the superst factory is correctly initialized or use BaseFunctionFactory(FunctionFactory) and then manually add each function.

Method Detail

addFunction

public void addFunction(Function function)
                 throws java.lang.IllegalArgumentException
Adds the function to the factory. Most functions have no state, so the singleton model used here is typically desireable. The factory will not enforce the requirement that a Target or Condition matching function must be boolean.

Specified by:
addFunction in class FunctionFactory

addAbstractFunction

public void addAbstractFunction(FunctionProxy proxy,
                                java.net.URI identity)
                         throws java.lang.IllegalArgumentException
Adds the abstract function proxy to the factory. This is used for those functions which have state, or change behavior (for instance the standard map function, which changes its return type based on how it is used).

Specified by:
addAbstractFunction in class FunctionFactory

getSupportedFunctions

public java.util.Set getSupportedFunctions()
Returns the function identifiers supported by this factory.

Specified by:
getSupportedFunctions in class FunctionFactory

createFunction

public Function createFunction(java.net.URI identity)
                        throws com.sun.xacml.UnknownIdentifierException,
                               FunctionTypeException
Tries to get an instance of the specified function.

Specified by:
createFunction in class FunctionFactory

createFunction

public Function createFunction(java.lang.String identity)
                        throws com.sun.xacml.UnknownIdentifierException,
                               FunctionTypeException
Tries to get an instance of the specified function.

Specified by:
createFunction in class FunctionFactory

createAbstractFunction

public Function createAbstractFunction(java.net.URI identity,
                                       org.w3c.dom.Node root)
                                throws com.sun.xacml.UnknownIdentifierException,
                                       com.sun.xacml.ParsingException,
                                       FunctionTypeException
Tries to get an instance of the specified abstract function.

Specified by:
createAbstractFunction in class FunctionFactory

createAbstractFunction

public Function createAbstractFunction(java.net.URI identity,
                                       org.w3c.dom.Node root,
                                       java.lang.String xpathVersion)
                                throws com.sun.xacml.UnknownIdentifierException,
                                       com.sun.xacml.ParsingException,
                                       FunctionTypeException
Tries to get an instance of the specified abstract function.

Specified by:
createAbstractFunction in class FunctionFactory

createAbstractFunction

public Function createAbstractFunction(java.lang.String identity,
                                       org.w3c.dom.Node root)
                                throws com.sun.xacml.UnknownIdentifierException,
                                       com.sun.xacml.ParsingException,
                                       FunctionTypeException
Tries to get an instance of the specified abstract function.

Specified by:
createAbstractFunction in class FunctionFactory

createAbstractFunction

public Function createAbstractFunction(java.lang.String identity,
                                       org.w3c.dom.Node root,
                                       java.lang.String xpathVersion)
                                throws com.sun.xacml.UnknownIdentifierException,
                                       com.sun.xacml.ParsingException,
                                       FunctionTypeException
Tries to get an instance of the specified abstract function.

Specified by:
createAbstractFunction in class FunctionFactory