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

Quick Search    Search Deep

com.sun.xacml
Class ConfigurationStore  view ConfigurationStore download ConfigurationStore.java

java.lang.Object
  extended bycom.sun.xacml.ConfigurationStore

public class ConfigurationStore
extends java.lang.Object

This class supports run-time loading of configuration data. It loads the configurations from an XML file that conforms to the configuration schema. By design this class does not get used automatically, nor does it change the state of the system directly. A programmer must choose to support this mechanism in their program, and then must explicitly use loaded elements. This way, the programmer still has full control over their security model, but also has the convenience of re-using a common configuration mechanism. See http://sunxacml.sourceforge.net/schema/config-0.3.xsd for the valid schema.

Note that becuase this doesn't tie directly into the rest of the code, you are still free to design your own run-time configuration mechanisms. This is simply provided as a convenience, and so that all programmers can start from a common point.

NOTE: The name of this class, its interfaces, and they way it interacts with the rest of the code is currently unstable, so expect some changes between now and the next release.

Since:
1.2

Field Summary
private  java.util.HashMap attributeMap
           
private  java.util.HashMap combiningMap
           
private  com.sun.xacml.attr.AttributeFactory defaultAttributeFactory
           
private  com.sun.xacml.combine.CombiningAlgFactory defaultCombiningFactory
           
private  com.sun.xacml.cond.FunctionFactoryProxy defaultFunctionFactoryProxy
           
private  PDPConfig defaultPDPConfig
           
private  java.util.HashMap functionMap
           
private static java.util.logging.Logger logger
           
static java.lang.String PDP_CONFIG_PROPERTY
          Property used to specify the configuration file.
private  java.util.HashMap pdpConfigMap
           
 
Constructor Summary
ConfigurationStore()
          Default constructor.
ConfigurationStore(java.io.File configFile)
          Constructor that explicitly specifies the configuration file to load.
 
Method Summary
private  void functionParserHelper(org.w3c.dom.Node root, com.sun.xacml.cond.FunctionFactory factory)
          Private helper used by the function factory code to load a specific target, condition, or general section.
private  java.util.List getArgs(org.w3c.dom.Node root)
          Private helper that gets the constructor arguments for a given class.
 com.sun.xacml.attr.AttributeFactory getAttributeFactory(java.lang.String name)
          Returns the attribute factory with the given name.
 com.sun.xacml.combine.CombiningAlgFactory getCombiningAlgFactory(java.lang.String name)
          Returns the combiningAlg factory with the given name.
 com.sun.xacml.attr.AttributeFactory getDefaultAttributeFactory()
          Returns the default attribute factory.
 com.sun.xacml.combine.CombiningAlgFactory getDefaultCombiningAlgFactory()
          Returns the default combiningAlg factory.
 com.sun.xacml.cond.FunctionFactoryProxy getDefaultFunctionFactoryProxy()
          Returns the default function factory proxy.
 PDPConfig getDefaultPDPConfig()
          Returns the default PDP configuration.
 com.sun.xacml.cond.FunctionFactoryProxy getFunctionFactoryProxy(java.lang.String name)
          Returns the function factory proxy with the given name.
 PDPConfig getPDPConfig(java.lang.String name)
          Returns the PDP configuration with the given name.
private  org.w3c.dom.Node getRootNode(java.io.File configFile)
          Private helper that parses the file and sets up the DOM tree.
 java.util.Set getSupportedAttributeFactories()
          Returns a set of identifiers representing each attribute factory available.
 java.util.Set getSupportedCombiningAlgFactories()
          Returns a set of identifiers representing each combiningAlg factory available.
 java.util.Set getSupportedFunctionFactories()
          Returns a set of identifiers representing each function factory proxy available.
 java.util.Set getSupportedPDPConfigurations()
          Returns a set of identifiers representing each PDP configuration available.
private  java.lang.Object loadClass(java.lang.String prefix, org.w3c.dom.Node root)
          Private helper that is used by all the code to load an instance of the given class...this assumes that the class is in the classpath, both for simplicity and for stronger security
private  com.sun.xacml.attr.AttributeFactory parseAttributeFactory(org.w3c.dom.Node root)
          Private helper that handles the attributeFactory elements.
private  com.sun.xacml.combine.CombiningAlgFactory parseCombiningAlgFactory(org.w3c.dom.Node root)
          Private helper that handles the combiningAlgFactory elements.
private  com.sun.xacml.cond.FunctionFactoryProxy parseFunctionFactory(org.w3c.dom.Node root)
          Private helper that handles the functionFactory elements.
private  PDPConfig parsePDPConfig(org.w3c.dom.Node root)
          Private helper that handles the pdp elements.
private  void setupConfig(java.io.File configFile)
          Private helper function used by both constructors to actually load the configuration data.
 void useDefaultFactories()
          Uses the default configuration to re-set the default factories used by the system (attribute, combining algorithm, and function).
private  boolean useStandard(org.w3c.dom.Node node, java.lang.String attributeName)
          Private helper used by the three factory routines to see if the given factory should be based on the standard setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PDP_CONFIG_PROPERTY

public static final java.lang.String PDP_CONFIG_PROPERTY
Property used to specify the configuration file.

See Also:
Constant Field Values

defaultPDPConfig

private PDPConfig defaultPDPConfig

pdpConfigMap

private java.util.HashMap pdpConfigMap

defaultAttributeFactory

private com.sun.xacml.attr.AttributeFactory defaultAttributeFactory

attributeMap

private java.util.HashMap attributeMap

defaultCombiningFactory

private com.sun.xacml.combine.CombiningAlgFactory defaultCombiningFactory

combiningMap

private java.util.HashMap combiningMap

defaultFunctionFactoryProxy

private com.sun.xacml.cond.FunctionFactoryProxy defaultFunctionFactoryProxy

functionMap

private java.util.HashMap functionMap

logger

private static final java.util.logging.Logger logger
Constructor Detail

ConfigurationStore

public ConfigurationStore()
                   throws ParsingException
Default constructor. This constructor uses the PDP_CONFIG_PROPERTY property to load the configuration. If the property isn't set, if it names a file that can't be accessed, or if the file is invalid, then an exception is thrown.


ConfigurationStore

public ConfigurationStore(java.io.File configFile)
                   throws ParsingException
Constructor that explicitly specifies the configuration file to load. This is useful if your security model doesn't allow the use of properties, if you don't want to use a property to specify a configuration file, or if you want to use more then one configuration file. If the file can't be accessed, or if the file is invalid, then an exception is thrown.

Method Detail

setupConfig

private void setupConfig(java.io.File configFile)
                  throws ParsingException
Private helper function used by both constructors to actually load the configuration data. This is the root of several private methods used to setup all the pdps and factories.


getRootNode

private org.w3c.dom.Node getRootNode(java.io.File configFile)
                              throws ParsingException
Private helper that parses the file and sets up the DOM tree.


parsePDPConfig

private PDPConfig parsePDPConfig(org.w3c.dom.Node root)
                          throws ParsingException
Private helper that handles the pdp elements.


parseAttributeFactory

private com.sun.xacml.attr.AttributeFactory parseAttributeFactory(org.w3c.dom.Node root)
                                                           throws ParsingException
Private helper that handles the attributeFactory elements.


parseCombiningAlgFactory

private com.sun.xacml.combine.CombiningAlgFactory parseCombiningAlgFactory(org.w3c.dom.Node root)
                                                                    throws ParsingException
Private helper that handles the combiningAlgFactory elements.


parseFunctionFactory

private com.sun.xacml.cond.FunctionFactoryProxy parseFunctionFactory(org.w3c.dom.Node root)
                                                              throws ParsingException
Private helper that handles the functionFactory elements. This one is a little more complex than the other two factory helper methods, since it consists of three factories (target, condition, and general).


functionParserHelper

private void functionParserHelper(org.w3c.dom.Node root,
                                  com.sun.xacml.cond.FunctionFactory factory)
                           throws ParsingException
Private helper used by the function factory code to load a specific target, condition, or general section.


loadClass

private java.lang.Object loadClass(java.lang.String prefix,
                                   org.w3c.dom.Node root)
                            throws ParsingException
Private helper that is used by all the code to load an instance of the given class...this assumes that the class is in the classpath, both for simplicity and for stronger security


getArgs

private java.util.List getArgs(org.w3c.dom.Node root)
Private helper that gets the constructor arguments for a given class. Right now this just supports String and List, but it's trivial to add support for other types should that be needed. Right now, it's not clear that there's any need for other types.


useStandard

private boolean useStandard(org.w3c.dom.Node node,
                            java.lang.String attributeName)
Private helper used by the three factory routines to see if the given factory should be based on the standard setup


getDefaultPDPConfig

public PDPConfig getDefaultPDPConfig()
                              throws UnknownIdentifierException
Returns the default PDP configuration. If no default was specified then this throws an exception.


getPDPConfig

public PDPConfig getPDPConfig(java.lang.String name)
                       throws UnknownIdentifierException
Returns the PDP configuration with the given name. If no such configuration exists then an exception is thrown.


getSupportedPDPConfigurations

public java.util.Set getSupportedPDPConfigurations()
Returns a set of identifiers representing each PDP configuration available.


getDefaultAttributeFactory

public com.sun.xacml.attr.AttributeFactory getDefaultAttributeFactory()
                                                               throws UnknownIdentifierException
Returns the default attribute factory. If no default was specified then this throws an exception.


getAttributeFactory

public com.sun.xacml.attr.AttributeFactory getAttributeFactory(java.lang.String name)
                                                        throws UnknownIdentifierException
Returns the attribute factory with the given name. If no such factory exists then an exception is thrown.


getSupportedAttributeFactories

public java.util.Set getSupportedAttributeFactories()
Returns a set of identifiers representing each attribute factory available.


getDefaultCombiningAlgFactory

public com.sun.xacml.combine.CombiningAlgFactory getDefaultCombiningAlgFactory()
                                                                        throws UnknownIdentifierException
Returns the default combiningAlg factory. If no default was specified then this throws an exception.


getCombiningAlgFactory

public com.sun.xacml.combine.CombiningAlgFactory getCombiningAlgFactory(java.lang.String name)
                                                                 throws UnknownIdentifierException
Returns the combiningAlg factory with the given name. If no such factory exists then an exception is thrown.


getSupportedCombiningAlgFactories

public java.util.Set getSupportedCombiningAlgFactories()
Returns a set of identifiers representing each combiningAlg factory available.


getDefaultFunctionFactoryProxy

public com.sun.xacml.cond.FunctionFactoryProxy getDefaultFunctionFactoryProxy()
                                                                       throws UnknownIdentifierException
Returns the default function factory proxy. If no default was specified then this throws an exception.


getFunctionFactoryProxy

public com.sun.xacml.cond.FunctionFactoryProxy getFunctionFactoryProxy(java.lang.String name)
                                                                throws UnknownIdentifierException
Returns the function factory proxy with the given name. If no such proxy exists then an exception is thrown.


getSupportedFunctionFactories

public java.util.Set getSupportedFunctionFactories()
Returns a set of identifiers representing each function factory proxy available.


useDefaultFactories

public void useDefaultFactories()
Uses the default configuration to re-set the default factories used by the system (attribute, combining algorithm, and function). If a default is not provided for a given factory, then that factory will not be set as the system's default.