/*
* @(#)ConfigurationStore.java
*
* Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import com.sun.xacml.attr.AttributeFactory;
import com.sun.xacml.attr.AttributeFactoryProxy;
import com.sun.xacml.attr.AttributeProxy;
import com.sun.xacml.attr.BaseAttributeFactory;
import com.sun.xacml.attr.StandardAttributeFactory;
import com.sun.xacml.combine.BaseCombiningAlgFactory;
import com.sun.xacml.combine.CombiningAlgFactory;
import com.sun.xacml.combine.CombiningAlgFactoryProxy;
import com.sun.xacml.combine.CombiningAlgorithm;
import com.sun.xacml.combine.StandardCombiningAlgFactory;
import com.sun.xacml.cond.BaseFunctionFactory;
import com.sun.xacml.cond.BasicFunctionFactoryProxy;
import com.sun.xacml.cond.Function;
import com.sun.xacml.cond.FunctionProxy;
import com.sun.xacml.cond.FunctionFactory;
import com.sun.xacml.cond.FunctionFactoryProxy;
import com.sun.xacml.cond.StandardFunctionFactory;
import com.sun.xacml.cond.cluster.FunctionCluster;
import com.sun.xacml.finder.AttributeFinder;
import com.sun.xacml.finder.PolicyFinder;
import com.sun.xacml.finder.ResourceFinder;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* 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.4.xsd for
* the valid schema.
* <p>
* 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.
*
* @since 1.2
* @author Seth Proctor
*/
public class ConfigurationStore
{
/**
* Property used to specify the configuration file.
*/
public static final String PDP_CONFIG_PROPERTY =
"com.sun.xacml.PDPConfigFile";
// pdp elements
private PDPConfig defaultPDPConfig;
private HashMap pdpConfigMap;
// attribute factory elements
private AttributeFactory defaultAttributeFactory;
private HashMap attributeMap;
// combining algorithm factory elements
private CombiningAlgFactory defaultCombiningFactory;
private HashMap combiningMap;
// function factory elements
private FunctionFactoryProxy defaultFunctionFactoryProxy;
private HashMap functionMap;
// the classloader we'll use for loading classes
private ClassLoader loader;
// the logger we'll use for all messages
private static final Logger logger =
Logger.getLogger(ConfigurationStore.class.getName());
/**
* Default constructor. This constructor uses the
* <code>PDP_CONFIG_PROPERTY</code> 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.
*
* @throws ParsingException if anything goes wrong during the parsing
* of the configuration file, the class loading,
* or the factory and pdp setup
*/
public ConfigurationStore() throws ParsingException {
String configFile = System.getProperty(PDP_CONFIG_PROPERTY);
// make sure that the right property was set
if (configFile == null) {
logger.severe("A property defining a config file was expected, " +
"but none was provided");
throw new ParsingException("Config property " +
PDP_CONFIG_PROPERTY +
" needs to be set");
}
try {
setupConfig(new File(configFile));
} catch (ParsingException pe) {
logger.log(Level.SEVERE, "Runtime config file couldn't be loaded" +
" so no configurations will be available", pe);
throw pe;
}
}
/**
* 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.
*
* @throws ParsingException if anything goes wrong during the parsing
* of the configuration file, the class loading,
* or the factory and pdp setup
*/
public ConfigurationStore(File configFile) throws ParsingException {
try {
setupConfig(configFile);
} catch (ParsingException pe) {
logger.log(Level.SEVERE, "Runtime config file couldn't be loaded" +
" so no configurations will be ava
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
Xacml.rar_XACML_clearhistory.r_sunxacml_xacml ja (691个子文件)
ConfigurationStore.class 22KB
ConfigurationStore.class 22KB
ComparisonFunction.class 11KB
ComparisonFunction.class 11KB
BasicEvaluationCtx.class 11KB
BasicEvaluationCtx.class 11KB
AbstractPolicy.class 10KB
AbstractPolicy.class 10KB
HigherOrderFunction.class 10KB
HigherOrderFunction.class 10KB
Policy.class 9KB
Policy.class 9KB
PolicySet.class 9KB
PolicySet.class 9KB
PolicyReference.class 9KB
PolicyReference.class 9KB
TargetMatch.class 8KB
DateTimeAttribute.class 8KB
TargetMatch.class 8KB
DateTimeAttribute.class 8KB
RequestCtx.class 8KB
DateAttribute.class 8KB
DateAttribute.class 8KB
Rule.class 8KB
AttributeDesignator.class 8KB
RequestCtx.class 8KB
Rule.class 7KB
AttributeDesignator.class 7KB
MatchFunction.class 7KB
MatchFunction.class 7KB
DayTimeDurationAttribute.class 7KB
DayTimeDurationAttribute.class 7KB
MapFunction.class 7KB
MapFunction.class 7KB
DateMathFunction.class 7KB
StandardFunctionFactory.class 7KB
DateMathFunction.class 7KB
StandardFunctionFactory.class 7KB
FunctionBase.class 7KB
FunctionBase.class 7KB
Result.class 6KB
AttributeSelector.class 6KB
Result.class 6KB
PDP.class 6KB
PDP.class 6KB
AttributeSelector.class 6KB
TimeAttribute.class 6KB
TimeAttribute.class 6KB
GeneralBagFunction.class 6KB
Apply.class 6KB
Apply.class 6KB
GeneralBagFunction.class 6KB
Target.class 6KB
YearMonthDurationAttribute.class 5KB
Status.class 5KB
Target.class 5KB
Attribute.class 5KB
Status.class 5KB
YearMonthDurationAttribute.class 5KB
Attribute.class 5KB
Condition.class 5KB
Obligation.class 5KB
Condition.class 5KB
EqualFunction.class 5KB
Obligation.class 5KB
EqualFunction.class 5KB
BaseFunctionFactory.class 5KB
BaseFunctionFactory.class 5KB
ConditionSetFunction.class 5KB
ConditionSetFunction.class 5KB
StandardAttributeFactory.class 5KB
VariableManager.class 5KB
VariableManager.class 5KB
GeneralSetFunction.class 5KB
StandardAttributeFactory.class 5KB
PolicyMetaData.class 5KB
SelectorModule.class 5KB
PolicyFinder.class 5KB
PolicyMetaData.class 5KB
SelectorModule.class 5KB
PolicyFinder.class 5KB
FunctionFactory.class 5KB
FunctionFactory.class 4KB
GeneralSetFunction.class 4KB
StandardCombiningAlgFactory.class 4KB
StandardCombiningAlgFactory.class 4KB
TargetSection.class 4KB
TargetSection.class 4KB
InputParser.class 4KB
InputParser.class 4KB
AttributeFinder.class 4KB
AttributeFinder.class 4KB
VariableReference.class 4KB
ExpressionHandler.class 4KB
VariableReference.class 4KB
HexBinaryAttribute.class 4KB
BaseAttributeFactory.class 4KB
ExpressionHandler.class 4KB
BaseAttributeFactory.class 4KB
CurrentEnvModule.class 4KB
共 691 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
钱亚锋
- 粉丝: 86
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0