sunxacml-commit Mailing List for Sun's XACML Implementation (Page 4)
Brought to you by:
farrukh_najmi,
sethp
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(3) |
Jul
(6) |
Aug
(37) |
Sep
(5) |
Oct
(6) |
Nov
(1) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
(11) |
Mar
(26) |
Apr
(5) |
May
(27) |
Jun
(13) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2005 |
Jan
(12) |
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2006 |
Jan
(10) |
Feb
(6) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Seth P. <se...@us...> - 2004-06-04 17:50:48
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7308/com/sun/xacml/attr Modified Files: AttributeDesignator.java AttributeSelector.java StandardAttributeFactory.java Log Message: Introduced some new, basic logging Index: StandardAttributeFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/StandardAttributeFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StandardAttributeFactory.java 24 May 2004 20:55:07 -0000 1.4 --- StandardAttributeFactory.java 4 Jun 2004 17:50:39 -0000 1.5 *************** *** 57,60 **** --- 57,62 ---- import java.util.Map; + import java.util.logging.Logger; + import org.w3c.dom.Node; *************** *** 86,89 **** --- 88,95 ---- private static Map supportedDatatypes = null; + // the logger we'll use for all messages + private static final Logger logger = + Logger.getLogger(StandardAttributeFactory.class.getName()); + /** * Private constructor that sets up proxies for all of the standard *************** *** 99,102 **** --- 105,110 ---- */ private static void initDatatypes() { + logger.config("Initializing standard datatypes"); + supportedDatatypes = new HashMap(); Index: AttributeDesignator.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeDesignator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AttributeDesignator.java 14 May 2004 20:43:07 -0000 1.6 --- AttributeDesignator.java 4 Jun 2004 17:50:39 -0000 1.7 *************** *** 60,63 **** --- 60,66 ---- import java.util.List; + import java.util.logging.Level; + import java.util.logging.Logger; + import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; *************** *** 120,123 **** --- 123,130 ---- private URI subjectCategory; + // the logger we'll use for all messages + private static final Logger logger = + Logger.getLogger(AttributeDesignator.class.getName()); + /** * Creates a new <code>AttributeDesignator</code> without the optional *************** *** 371,374 **** --- 378,386 ---- // if it's empty, this may be an error if (mustBePresent) { + if (logger.isLoggable(Level.INFO)) + logger.info("AttributeDesignator failed to resolve a " + + "value for a required attribute: " + + id.toString()); + ArrayList code = new ArrayList(); code.add(Status.STATUS_MISSING_ATTRIBUTE); Index: AttributeSelector.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeSelector.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AttributeSelector.java 14 May 2004 20:43:07 -0000 1.9 --- AttributeSelector.java 4 Jun 2004 17:50:39 -0000 1.10 *************** *** 55,58 **** --- 55,61 ---- import java.util.List; + import java.util.logging.Level; + import java.util.logging.Logger; + import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; *************** *** 86,89 **** --- 89,96 ---- private Node policyRoot; + // the logger we'll use for all messages + private static final Logger logger = + Logger.getLogger(AttributeSelector.class.getName()); + /** * Creates a new <code>AttributeSelector</code> with no policy root. *************** *** 291,294 **** --- 298,306 ---- if (mustBePresent) { // this is an error + if (logger.isLoggable(Level.INFO)) + logger.info("AttributeSelector failed to resolve a " + + "value for a required attribute: " + + contextPath); + ArrayList code = new ArrayList(); code.add(Status.STATUS_MISSING_ATTRIBUTE); |
From: Seth P. <se...@us...> - 2004-06-04 17:50:48
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7308/com/sun/xacml/combine Modified Files: StandardCombiningAlgFactory.java Log Message: Introduced some new, basic logging Index: StandardCombiningAlgFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine/StandardCombiningAlgFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StandardCombiningAlgFactory.java 24 May 2004 20:55:07 -0000 1.4 --- StandardCombiningAlgFactory.java 4 Jun 2004 17:50:39 -0000 1.5 *************** *** 42,45 **** --- 42,48 ---- import java.util.Set; + import java.util.logging.Level; + import java.util.logging.Logger; + /** *************** *** 69,72 **** --- 72,79 ---- private static Set supportedAlgorithms = null; + // the logger we'll use for all messages + private static final Logger logger = + Logger.getLogger(StandardCombiningAlgFactory.class.getName()); + /** * Default constructor. *************** *** 81,84 **** --- 88,93 ---- */ private static void initAlgorithms() { + logger.config("Initializing standard combining algorithms"); + supportedAlgorithms = new HashSet(); |
From: Seth P. <se...@us...> - 2004-05-27 19:45:22
|
Update of /cvsroot/sunxacml/tests/com/sun/xacml/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6804/com/sun/xacml/test Modified Files: TestDriver.java Log Message: cleaned up factory initialization code Index: TestDriver.java =================================================================== RCS file: /cvsroot/sunxacml/tests/com/sun/xacml/test/TestDriver.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TestDriver.java 18 May 2004 21:20:50 -0000 1.1.1.1 --- TestDriver.java 27 May 2004 19:45:11 -0000 1.2 *************** *** 41,53 **** import com.sun.xacml.PDPConfig; - import com.sun.xacml.attr.AttributeFactory; - import com.sun.xacml.attr.AttributeFactoryProxy; - - import com.sun.xacml.combine.CombiningAlgFactory; - import com.sun.xacml.combine.CombiningAlgFactoryProxy; - - import com.sun.xacml.cond.FunctionFactory; - import com.sun.xacml.cond.FunctionFactoryProxy; - import com.sun.xacml.finder.PolicyFinder; --- 41,44 ---- *************** *** 112,136 **** ConfigurationStore cs = new ConfigurationStore(); ! // setup the attribute factory ! final AttributeFactory attrFactory = cs.getDefaultAttributeFactory(); ! AttributeFactory.setDefaultFactory(new AttributeFactoryProxy() { ! private AttributeFactory factory = attrFactory; ! public AttributeFactory getFactory() { ! return attrFactory; ! } ! }); ! ! // setup the combining algorithm factory ! final CombiningAlgFactory combFactory = ! cs.getDefaultCombiningAlgFactory(); ! CombiningAlgFactory.setDefaultFactory(new CombiningAlgFactoryProxy() { ! private CombiningAlgFactory factory = combFactory; ! public CombiningAlgFactory getFactory() { ! return factory; ! } ! }); ! ! // setup the function factory ! FunctionFactory.setDefaultFactory(cs.getDefaultFunctionFactoryProxy()); // get the PDP configuration's policy finder modules... --- 103,108 ---- ConfigurationStore cs = new ConfigurationStore(); ! // use the default factories from the configuration ! cs.useDefaultFactories(); // get the PDP configuration's policy finder modules... |
From: Seth P. <se...@us...> - 2004-05-27 19:39:44
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5659/com/sun/xacml Modified Files: ConfigurationStore.java Log Message: added a useDefaultFactories convenience method Index: ConfigurationStore.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ConfigurationStore.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConfigurationStore.java 24 May 2004 20:55:06 -0000 1.5 --- ConfigurationStore.java 27 May 2004 19:39:35 -0000 1.6 *************** *** 38,41 **** --- 38,42 ---- import com.sun.xacml.attr.AttributeFactory; + import com.sun.xacml.attr.AttributeFactoryProxy; import com.sun.xacml.attr.AttributeProxy; import com.sun.xacml.attr.BaseAttributeFactory; *************** *** 44,47 **** --- 45,49 ---- 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; *************** *** 273,277 **** /** * Private helper that parses the file and sets up the DOM tree. - * FIXME: add schema validation support before 1.2 is final */ private Node getRootNode(File configFile) throws ParsingException { --- 275,278 ---- *************** *** 655,660 **** * 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...the question is what types are needed. ! * FIXME: decide on what types will be supported */ private List getArgs(Node root) { --- 656,661 ---- * 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. */ private List getArgs(Node root) { *************** *** 879,881 **** --- 880,913 ---- } + /** + * 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. + */ + public void useDefaultFactories() { + // set the default attribute factory, if it exists here + if (defaultAttributeFactory != null) { + AttributeFactory.setDefaultFactory(new AttributeFactoryProxy() { + public AttributeFactory getFactory() { + return defaultAttributeFactory; + } + }); + } + + // set the default combining algorithm factory, if it exists here + if (defaultCombiningFactory != null) { + CombiningAlgFactory. + setDefaultFactory(new CombiningAlgFactoryProxy() { + public CombiningAlgFactory getFactory() { + return defaultCombiningFactory; + } + }); + } + + // set the default function factories, if they exists here + if (defaultFunctionFactoryProxy != null) + FunctionFactory.setDefaultFactory(defaultFunctionFactoryProxy); + } + } |
From: Seth P. <se...@us...> - 2004-05-24 21:39:31
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27240/com/sun/xacml/cond Modified Files: ComparisonFunction.java ConditionBagFunction.java ConditionSetFunction.java DateMathFunction.java EqualFunction.java GeneralBagFunction.java GeneralSetFunction.java HigherOrderFunction.java Log Message: updated getSupportedIdentifiers to be much more efficient Index: GeneralBagFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/GeneralBagFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GeneralBagFunction.java 18 Mar 2004 21:13:09 -0000 1.3 --- GeneralBagFunction.java 24 May 2004 21:39:22 -0000 1.4 *************** *** 44,47 **** --- 44,48 ---- import java.util.Arrays; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 68,71 **** --- 69,73 ---- // mapping of function name to its associated parameters private static HashMap paramMap; + private static Set supportedIds; /** *************** *** 75,88 **** static { paramMap = new HashMap(); - - paramMap.put(NAME_BASE_ONE_AND_ONLY, - new BagParameters(ID_BASE_ONE_AND_ONLY, null, true, 1, - null, false)); - paramMap.put(NAME_BASE_BAG_SIZE, - new BagParameters(ID_BASE_BAG_SIZE, null, true, 1, - IntegerAttribute.identifier, false)); - paramMap.put(NAME_BASE_BAG, - new BagParameters(ID_BASE_BAG, null, false, -1, null, - true)); for (int i = 0; i < baseTypes.length; i++) { --- 77,80 ---- *************** *** 103,106 **** --- 95,113 ---- baseType, true)); } + + supportedIds = Collections. + unmodifiableSet(new HashSet(paramMap.keySet())); + + paramMap.put(NAME_BASE_ONE_AND_ONLY, + new BagParameters(ID_BASE_ONE_AND_ONLY, null, true, 1, + null, false)); + paramMap.put(NAME_BASE_BAG_SIZE, + new BagParameters(ID_BASE_BAG_SIZE, null, true, 1, + IntegerAttribute.identifier, false)); + paramMap.put(NAME_BASE_BAG, + new BagParameters(ID_BASE_BAG, null, false, -1, null, + true)); + + }; *************** *** 228,242 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! for (int i = 0; i < simpleTypes.length; i++) { ! String baseName = FunctionBase.FUNCTION_NS + simpleTypes[i]; ! ! set.add(baseName + NAME_BASE_ONE_AND_ONLY); ! set.add(baseName + NAME_BASE_BAG_SIZE); ! set.add(baseName + NAME_BASE_BAG); ! } ! ! return set; } --- 235,239 ---- */ public static Set getSupportedIdentifiers() { ! return supportedIds; } Index: ConditionSetFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/ConditionSetFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConditionSetFunction.java 18 Mar 2004 21:13:09 -0000 1.3 --- ConditionSetFunction.java 24 May 2004 21:39:22 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- import com.sun.xacml.attr.BooleanAttribute; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 70,73 **** --- 71,77 ---- private static HashMap typeMap; + // the actual supported ids + private static Set supportedIds; + /** * Static initializer that sets up the paramater info for all the *************** *** 78,86 **** typeMap = new HashMap(); - idMap.put(NAME_BASE_AT_LEAST_ONE_MEMBER_OF, - new Integer(ID_BASE_AT_LEAST_ONE_MEMBER_OF)); - idMap.put(NAME_BASE_SUBSET, new Integer(ID_BASE_SUBSET)); - idMap.put(NAME_BASE_SET_EQUALS, new Integer(ID_BASE_SET_EQUALS)); - for (int i = 0; i < baseTypes.length; i++) { String baseName = FUNCTION_NS + simpleTypes[i]; --- 82,85 ---- *************** *** 98,101 **** --- 97,108 ---- typeMap.put(baseName + NAME_BASE_SET_EQUALS, baseType); } + + supportedIds = Collections. + unmodifiableSet(new HashSet(idMap.keySet())); + + idMap.put(NAME_BASE_AT_LEAST_ONE_MEMBER_OF, + new Integer(ID_BASE_AT_LEAST_ONE_MEMBER_OF)); + idMap.put(NAME_BASE_SUBSET, new Integer(ID_BASE_SUBSET)); + idMap.put(NAME_BASE_SET_EQUALS, new Integer(ID_BASE_SET_EQUALS)); }; *************** *** 164,178 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! for (int i = 0; i < simpleTypes.length; i++) { ! String baseName = FunctionBase.FUNCTION_NS + simpleTypes[i]; ! ! set.add(baseName + NAME_BASE_AT_LEAST_ONE_MEMBER_OF); ! set.add(baseName + NAME_BASE_SUBSET); ! set.add(baseName + NAME_BASE_SET_EQUALS); ! } ! ! return set; } --- 171,175 ---- */ public static Set getSupportedIdentifiers() { ! return supportedIds; } Index: ComparisonFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/ComparisonFunction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ComparisonFunction.java 18 Mar 2004 21:13:09 -0000 1.5 --- ComparisonFunction.java 24 May 2004 21:39:22 -0000 1.6 *************** *** 48,51 **** --- 48,52 ---- import com.sun.xacml.attr.TimeAttribute; + import java.util.Collections; import java.util.Date; import java.util.HashMap; *************** *** 379,410 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! set.add(NAME_INTEGER_GREATER_THAN); ! set.add(NAME_INTEGER_GREATER_THAN_OR_EQUAL); ! set.add(NAME_INTEGER_LESS_THAN); ! set.add(NAME_INTEGER_LESS_THAN_OR_EQUAL); ! set.add(NAME_DOUBLE_GREATER_THAN); ! set.add(NAME_DOUBLE_GREATER_THAN_OR_EQUAL); ! set.add(NAME_DOUBLE_LESS_THAN); ! set.add(NAME_DOUBLE_LESS_THAN_OR_EQUAL); ! set.add(NAME_STRING_GREATER_THAN); ! set.add(NAME_STRING_GREATER_THAN_OR_EQUAL); ! set.add(NAME_STRING_LESS_THAN); ! set.add(NAME_STRING_LESS_THAN_OR_EQUAL); ! set.add(NAME_TIME_GREATER_THAN); ! set.add(NAME_TIME_GREATER_THAN_OR_EQUAL); ! set.add(NAME_TIME_LESS_THAN); ! set.add(NAME_TIME_LESS_THAN_OR_EQUAL); ! set.add(NAME_DATETIME_GREATER_THAN); ! set.add(NAME_DATETIME_GREATER_THAN_OR_EQUAL); ! set.add(NAME_DATETIME_LESS_THAN); ! set.add(NAME_DATETIME_LESS_THAN_OR_EQUAL); ! set.add(NAME_DATE_GREATER_THAN); ! set.add(NAME_DATE_GREATER_THAN_OR_EQUAL); ! set.add(NAME_DATE_LESS_THAN); ! set.add(NAME_DATE_LESS_THAN_OR_EQUAL); ! ! return set; } --- 380,384 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(idMap.keySet()); } Index: HigherOrderFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/HigherOrderFunction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HigherOrderFunction.java 18 Mar 2004 21:13:09 -0000 1.5 --- HigherOrderFunction.java 24 May 2004 21:39:22 -0000 1.6 *************** *** 47,50 **** --- 47,51 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 185,198 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! set.add(NAME_ANY_OF); ! set.add(NAME_ALL_OF); ! set.add(NAME_ANY_OF_ANY); ! set.add(NAME_ALL_OF_ANY); ! set.add(NAME_ANY_OF_ALL); ! set.add(NAME_ALL_OF_ALL); ! ! return set; } --- 186,190 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(idMap.keySet()); } Index: GeneralSetFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/GeneralSetFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GeneralSetFunction.java 18 Mar 2004 21:13:09 -0000 1.3 --- GeneralSetFunction.java 24 May 2004 21:39:22 -0000 1.4 *************** *** 42,45 **** --- 42,46 ---- import com.sun.xacml.attr.BagAttribute; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 155,168 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! for (int i = 0; i < simpleTypes.length; i++) { ! String baseName = FunctionBase.FUNCTION_NS + simpleTypes[i]; ! ! set.add(baseName + NAME_BASE_INTERSECTION); ! set.add(baseName + NAME_BASE_UNION); ! } ! ! return set; } --- 156,160 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(idMap.keySet()); } Index: ConditionBagFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/ConditionBagFunction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConditionBagFunction.java 18 Mar 2004 21:13:09 -0000 1.3 --- ConditionBagFunction.java 24 May 2004 21:39:22 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- import com.sun.xacml.attr.BooleanAttribute; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 125,136 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! for (int i = 0; i < simpleTypes.length; i++) { ! set.add(FunctionBase.FUNCTION_NS + simpleTypes[i] + ! NAME_BASE_IS_IN); ! } ! ! return set; } --- 126,130 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(argMap.keySet()); } Index: EqualFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/EqualFunction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EqualFunction.java 18 Mar 2004 21:13:09 -0000 1.5 --- EqualFunction.java 24 May 2004 21:39:22 -0000 1.6 *************** *** 55,58 **** --- 55,59 ---- import com.sun.xacml.attr.X500NameAttribute; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 257,279 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! set.add(NAME_STRING_EQUAL); ! set.add(NAME_BOOLEAN_EQUAL); ! set.add(NAME_INTEGER_EQUAL); ! set.add(NAME_DOUBLE_EQUAL); ! set.add(NAME_DATE_EQUAL); ! set.add(NAME_TIME_EQUAL); ! set.add(NAME_DATETIME_EQUAL); ! set.add(NAME_DAYTIME_DURATION_EQUAL); ! set.add(NAME_YEARMONTH_DURATION_EQUAL); ! set.add(NAME_ANYURI_EQUAL); ! set.add(NAME_X500NAME_EQUAL); ! set.add(NAME_RFC822NAME_EQUAL); ! set.add(NAME_HEXBINARY_EQUAL); ! set.add(NAME_BASE64BINARY_EQUAL); ! ! return set; ! } /** --- 258,263 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(typeMap.keySet()); ! } /** Index: DateMathFunction.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/DateMathFunction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DateMathFunction.java 18 Mar 2004 21:13:09 -0000 1.4 --- DateMathFunction.java 24 May 2004 21:39:22 -0000 1.5 *************** *** 46,49 **** --- 46,50 ---- import java.util.Calendar; + import java.util.Collections; import java.util.Date; import java.util.GregorianCalendar; *************** *** 232,245 **** */ public static Set getSupportedIdentifiers() { ! Set set = new HashSet(); ! ! set.add(NAME_DATETIME_ADD_DAYTIMEDURATION); ! set.add(NAME_DATETIME_SUBTRACT_DAYTIMEDURATION); ! set.add(NAME_DATETIME_ADD_YEARMONTHDURATION); ! set.add(NAME_DATETIME_SUBTRACT_YEARMONTHDURATION); ! set.add(NAME_DATE_ADD_YEARMONTHDURATION); ! set.add(NAME_DATE_SUBTRACT_YEARMONTHDURATION); ! ! return set; } --- 233,237 ---- */ public static Set getSupportedIdentifiers() { ! return Collections.unmodifiableSet(idMap.keySet()); } |
From: Seth P. <se...@us...> - 2004-05-24 20:55:18
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16626/com/sun/xacml/cond Modified Files: BaseFunctionFactory.java StandardFunctionFactory.java Log Message: re-factored so standard factories are immutable Index: StandardFunctionFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/StandardFunctionFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StandardFunctionFactory.java 18 Mar 2004 21:13:09 -0000 1.4 --- StandardFunctionFactory.java 24 May 2004 20:55:08 -0000 1.5 *************** *** 63,74 **** import java.net.URISyntaxException; import java.util.Iterator; /** * This factory supports the standard set of functions specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system. Like the other ! * standard factories, there is only one instance used, so changing the ! * contents of one instance will affect all other instances. * * @since 1.2 --- 63,89 ---- import java.net.URISyntaxException; + import java.util.Collections; + import java.util.HashSet; + import java.util.HashMap; import java.util.Iterator; + import java.util.Map; + import java.util.Set; /** * This factory supports the standard set of functions specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system, and imposes ! * a singleton pattern insuring that there is only ever one instance of ! * this class. ! * <p> ! * Note that because this supports only the standard functions, this ! * factory does not allow the addition of any other functions. If you call ! * <code>addFunction</code> on an instance of this class, an exception ! * will be thrown. If you need a standard factory that is modifiable, ! * you can either create a new <code>BaseFunctionFactory</code> (or some ! * other implementation of <code>FunctionFactory</code>) populated with ! * the standard functions from <code>getStandardFunctions</code> or ! * you can use <code>getNewFactoryProxy</code> to get a proxy containing ! * a new, modifiable set of factories. * * @since 1.2 *************** *** 78,190 **** { - // internal identifiers for the three kinds of factories - private static final int TARGET_FACTORY = 0; - private static final int CONDITION_FACTORY = 1; - private static final int GENERAL_FACTORY = 2; - // the three singleton instances ! private static FunctionFactory targetFactory = null; ! private static FunctionFactory conditionFactory = null; ! private static FunctionFactory generalFactory = null; ! // dummy object used as a lock for the getFactory routines ! // FIXME: this needs a better mechanism ! private static Object factoryLock = new Object(); /** * Creates a new StandardFunctionFactory, making sure that the default ! * maps are initialized correctly. */ ! private StandardFunctionFactory(int type, FunctionFactory superset) { ! super(superset); ! switch (type) { ! case TARGET_FACTORY: ! // add EqualFunction ! addFunctions((new EqualFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add LogicalFunction ! addFunctions((new LogicalFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add NOfFunction ! addFunctions((new NOfFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add NotFunction ! addFunctions((new NotFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add ComparisonFunction ! addFunctions((new ComparisonFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add MatchFunction ! addFunctions((new MatchFunctionCluster()).getSupportedFunctions(). ! iterator()); ! break; ! case CONDITION_FACTORY: ! // add condition functions from BagFunction ! addFunctions((new ConditionBagFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add condition functions from SetFunction ! addFunctions((new ConditionSetFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add condition functions from HigherOrderFunction ! addFunctions((new HigherOrderFunctionCluster()). ! getSupportedFunctions().iterator()); ! break; ! case GENERAL_FACTORY: ! // add AddFunction ! addFunctions((new AddFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add SubtractFunction ! addFunctions((new SubtractFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add MultiplyFunction ! addFunctions((new MultiplyFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add DivideFunction ! addFunctions((new DivideFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add ModFunction ! addFunctions((new ModFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add AbsFunction ! addFunctions((new AbsFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add RoundFunction ! addFunctions((new RoundFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add FloorFunction ! addFunctions((new FloorFunctionCluster()).getSupportedFunctions(). ! iterator()); ! // add DateMathFunction ! addFunctions((new DateMathFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add general functions from BagFunction ! addFunctions((new GeneralBagFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add NumericConvertFunction ! addFunctions((new NumericConvertFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add StringNormalizeFunction ! addFunctions((new StringNormalizeFunctionCluster()). ! getSupportedFunctions().iterator()); ! // add general functions from SetFunction ! addFunctions((new GeneralSetFunctionCluster()). ! getSupportedFunctions().iterator()); ! ! // add the map function's proxy ! try { ! addAbstractFunction(new MapFunctionProxy(), ! new URI(MapFunction.NAME_MAP)); ! } catch (URISyntaxException e) { ! // this shouldn't ever happen, but just in case... ! throw new IllegalArgumentException("invalid function name"); ! } ! break; ! } } ! private void addFunctions(Iterator it) { ! while (it.hasNext()) { ! addFunction((Function)(it.next())); } } --- 93,239 ---- { // the three singleton instances ! private static StandardFunctionFactory targetFactory = null; ! private static StandardFunctionFactory conditionFactory = null; ! private static StandardFunctionFactory generalFactory = null; ! // the three function sets/maps that we use internally ! private static Set targetFunctions = null; ! private static Set conditionFunctions = null; ! private static Set generalFunctions = null; ! ! private static Map targetAbstractFunctions = null; ! private static Map conditionAbstractFunctions = null; ! private static Map generalAbstractFunctions = null; ! ! // the set/map used by each singleton factory instance ! private Set supportedFunctions = null; ! private Map supportedAbstractFunctions = null; /** * Creates a new StandardFunctionFactory, making sure that the default ! * maps are initialized correctly. Standard factories can't be modified, ! * so there is no notion of supersetting since that's only used for ! * correctly propagating new functions. */ ! private StandardFunctionFactory(Set supportedFunctions, ! Map supportedAbstractFunctions) { ! super(supportedFunctions, supportedAbstractFunctions); ! this.supportedFunctions = supportedFunctions; ! this.supportedAbstractFunctions = supportedAbstractFunctions; } ! /** ! * Private initializer for the target functions. This is only ever ! * called once. ! */ ! private static void initTargetFunctions() { ! targetFunctions = new HashSet(); ! ! // add EqualFunction ! targetFunctions.addAll((new EqualFunctionCluster()). ! getSupportedFunctions()); ! // add LogicalFunction ! targetFunctions.addAll((new LogicalFunctionCluster()). ! getSupportedFunctions()); ! // add NOfFunction ! targetFunctions.addAll((new NOfFunctionCluster()). ! getSupportedFunctions()); ! // add NotFunction ! targetFunctions.addAll((new NotFunctionCluster()). ! getSupportedFunctions()); ! // add ComparisonFunction ! targetFunctions.addAll((new ComparisonFunctionCluster()). ! getSupportedFunctions()); ! // add MatchFunction ! targetFunctions.addAll((new MatchFunctionCluster()). ! getSupportedFunctions()); ! ! targetAbstractFunctions = new HashMap(); ! } ! ! /** ! * Private initializer for the condition functions. This is only ever ! * called once. ! */ ! private static void initConditionFunctions() { ! if (targetFunctions == null) ! initTargetFunctions(); ! ! conditionFunctions = new HashSet(targetFunctions); ! ! // add condition functions from BagFunction ! conditionFunctions.addAll((new ConditionBagFunctionCluster()). ! getSupportedFunctions()); ! // add condition functions from SetFunction ! conditionFunctions.addAll((new ConditionSetFunctionCluster()). ! getSupportedFunctions()); ! // add condition functions from HigherOrderFunction ! conditionFunctions.addAll((new HigherOrderFunctionCluster()). ! getSupportedFunctions()); ! ! conditionAbstractFunctions = new HashMap(targetAbstractFunctions); ! } ! ! /** ! * Private initializer for the general functions. This is only ever ! * called once. ! */ ! private static void initGeneralFunctions() { ! if (conditionFunctions == null) ! initConditionFunctions(); ! ! generalFunctions = new HashSet(conditionFunctions); ! ! // add AddFunction ! generalFunctions.addAll((new AddFunctionCluster()). ! getSupportedFunctions()); ! // add SubtractFunction ! generalFunctions.addAll((new SubtractFunctionCluster()). ! getSupportedFunctions()); ! // add MultiplyFunction ! generalFunctions.addAll((new MultiplyFunctionCluster()). ! getSupportedFunctions()); ! // add DivideFunction ! generalFunctions.addAll((new DivideFunctionCluster()). ! getSupportedFunctions()); ! // add ModFunction ! generalFunctions.addAll((new ModFunctionCluster()). ! getSupportedFunctions()); ! // add AbsFunction ! generalFunctions.addAll((new AbsFunctionCluster()). ! getSupportedFunctions()); ! // add RoundFunction ! generalFunctions.addAll((new RoundFunctionCluster()). ! getSupportedFunctions()); ! // add FloorFunction ! generalFunctions.addAll((new FloorFunctionCluster()). ! getSupportedFunctions()); ! // add DateMathFunction ! generalFunctions.addAll((new DateMathFunctionCluster()). ! getSupportedFunctions()); ! // add general functions from BagFunction ! generalFunctions.addAll((new GeneralBagFunctionCluster()). ! getSupportedFunctions()); ! // add NumericConvertFunction ! generalFunctions.addAll((new NumericConvertFunctionCluster()). ! getSupportedFunctions()); ! // add StringNormalizeFunction ! generalFunctions.addAll((new StringNormalizeFunctionCluster()). ! getSupportedFunctions()); ! // add general functions from SetFunction ! generalFunctions.addAll((new GeneralSetFunctionCluster()). ! getSupportedFunctions()); ! ! generalAbstractFunctions = new HashMap(conditionAbstractFunctions); ! ! // add the map function's proxy ! try { ! generalAbstractFunctions.put(new URI(MapFunction.NAME_MAP), ! new MapFunctionProxy()); ! } catch (URISyntaxException e) { ! // this shouldn't ever happen, but just in case... ! throw new IllegalArgumentException("invalid function name"); } } *************** *** 196,209 **** * the factory if it hasn't been requested before. This is the default * model used by the <code>FunctionFactory</code>, ensuring quick ! * access to this factory. If you need a new instance of this factory ! * you should use the <code>getNewFactory</code> method. * * @return a <code>FunctionFactory</code> for target functions */ ! public static FunctionFactory getTargetFactory() { if (targetFactory == null) { ! synchronized (factoryLock) { if (targetFactory == null) ! setupFactories(); } } --- 245,261 ---- * the factory if it hasn't been requested before. This is the default * model used by the <code>FunctionFactory</code>, ensuring quick ! * access to this factory. * * @return a <code>FunctionFactory</code> for target functions */ ! public static StandardFunctionFactory getTargetFactory() { if (targetFactory == null) { ! synchronized (StandardFunctionFactory.class) { ! if (targetFunctions == null) ! initTargetFunctions(); if (targetFactory == null) ! targetFactory = ! new StandardFunctionFactory(targetFunctions, ! targetAbstractFunctions); } } *************** *** 219,232 **** * the factory if it hasn't been requested before. This is the default * model used by the <code>FunctionFactory</code>, ensuring quick ! * access to this factory. If you need a new instance of this factory ! * you should use the <code>getNewFactory</code> method. * * @return a <code>FunctionFactory</code> for condition functions */ ! public static FunctionFactory getConditionFactory() { if (conditionFactory == null) { ! synchronized (factoryLock) { if (conditionFactory == null) ! setupFactories(); } } --- 271,287 ---- * the factory if it hasn't been requested before. This is the default * model used by the <code>FunctionFactory</code>, ensuring quick ! * access to this factory. * * @return a <code>FunctionFactory</code> for condition functions */ ! public static StandardFunctionFactory getConditionFactory() { if (conditionFactory == null) { ! synchronized (StandardFunctionFactory.class) { ! if (conditionFunctions == null) ! initConditionFunctions(); if (conditionFactory == null) ! conditionFactory = ! new StandardFunctionFactory(conditionFunctions, ! conditionAbstractFunctions); } } *************** *** 241,254 **** * instance, creating the factory if it hasn't been requested before. * This is the default model used by the <code>FunctionFactory</code>, ! * ensuring quick access to this factory. If you need a new instance of ! * this factory you should use the <code>getNewFactory</code> method. * * @return a <code>FunctionFactory</code> for all functions */ ! public static FunctionFactory getGeneralFactory() { if (generalFactory == null) { ! synchronized (factoryLock) { ! if (generalFactory == null) ! setupFactories(); } } --- 296,312 ---- * instance, creating the factory if it hasn't been requested before. * This is the default model used by the <code>FunctionFactory</code>, ! * ensuring quick access to this factory. * * @return a <code>FunctionFactory</code> for all functions */ ! public static StandardFunctionFactory getGeneralFactory() { if (generalFactory == null) { ! synchronized (StandardFunctionFactory.class) { ! if (generalFunctions == null) { ! initGeneralFunctions(); ! generalFactory = ! new StandardFunctionFactory(generalFunctions, ! generalAbstractFunctions); ! } } } *************** *** 258,285 **** /** ! * Returns a new instance of <code>FunctionFactoryProxy</code> with ! * new factories that support all the standard functions. */ ! public static FunctionFactoryProxy getNewFactory() { StandardFunctionFactory general = ! new StandardFunctionFactory(GENERAL_FACTORY, null); StandardFunctionFactory condition = ! new StandardFunctionFactory(CONDITION_FACTORY, general); StandardFunctionFactory target = ! new StandardFunctionFactory(TARGET_FACTORY, condition); ! return new BasicFunctionFactoryProxy(target, condition, general); } /** ! * Private helper that sets up the three factory instances with the ! * right dependencies on each other. */ ! private static void setupFactories() { ! generalFactory = new StandardFunctionFactory(GENERAL_FACTORY, null); ! conditionFactory = new StandardFunctionFactory(CONDITION_FACTORY, ! generalFactory); ! targetFactory = new StandardFunctionFactory(TARGET_FACTORY, ! conditionFactory); } --- 316,402 ---- /** ! * Returns the set of functions that this standard factory supports. ! * ! * @return a <code>Set</code> of <code>Function</code>s */ ! public Set getStandardFunctions() { ! return Collections.unmodifiableSet(supportedFunctions); ! } ! ! /** ! * Returns the set of abstract functions that this standard factory ! * supports as a mapping of identifier to proxy. ! * ! * @return a <code>Map</code> mapping <code>URI</code>s to ! * <code>FunctionProxy</code>s ! */ ! public Map getStandardAbstractFunctions() { ! return Collections.unmodifiableMap(supportedAbstractFunctions); ! } ! ! /** ! * A convenience method that returns a proxy containing newly created ! * instances of <code>BaseFunctionFactory</code>s that are correctly ! * supersetted and contain the standard functions and abstract functions. ! * These factories allow adding support for new functions. ! * ! * @return a new proxy containing new factories supporting the standard ! * functions ! */ ! public static FunctionFactoryProxy getNewFactoryProxy() { StandardFunctionFactory general = ! StandardFunctionFactory.getGeneralFactory(); ! FunctionFactory newGeneral = ! new BaseFunctionFactory(general.getStandardFunctions(), ! general.getStandardAbstractFunctions()); ! StandardFunctionFactory condition = ! StandardFunctionFactory.getConditionFactory(); ! FunctionFactory newCondition = ! new BaseFunctionFactory(newGeneral, ! condition.getStandardFunctions(), ! condition.getStandardAbstractFunctions()); ! StandardFunctionFactory target = ! StandardFunctionFactory.getTargetFactory(); ! FunctionFactory newTarget = ! new BaseFunctionFactory(newCondition, ! target.getStandardFunctions(), ! target.getStandardAbstractFunctions()); ! return new BasicFunctionFactoryProxy(newTarget, newCondition, ! newGeneral); } /** ! * Always throws an exception, since support for new functions may not be ! * added to a standard factory. ! * ! * @param function the <code>Function</code> to add to the factory ! * ! * @throws UnsupportedOperationException always */ ! public void addFunction(Function function) ! throws IllegalArgumentException ! { ! throw new UnsupportedOperationException("a standard factory cannot " + ! "support new functions"); ! } ! ! /** ! * Always throws an exception, since support for new functions may not be ! * added to a standard factory. ! * ! * @param proxy the <code>FunctionProxy</code> to add to the factory ! * @param identity the function's identifier ! * ! * @throws UnsupportedOperationException always ! */ ! public void addAbstractFunction(FunctionProxy proxy, ! URI identity) ! throws IllegalArgumentException ! { ! throw new UnsupportedOperationException("a standard factory cannot " + ! "support new functions"); } Index: BaseFunctionFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/BaseFunctionFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BaseFunctionFactory.java 17 May 2004 20:33:45 -0000 1.3 --- BaseFunctionFactory.java 24 May 2004 20:55:07 -0000 1.4 *************** *** 44,47 **** --- 44,49 ---- import java.util.HashMap; import java.util.HashSet; + import java.util.Iterator; + import java.util.Map; import java.util.Set; *************** *** 57,60 **** --- 59,70 ---- * may want to extend FunctionFactory directly, if you're writing a new * factory implementation. + * <p> + * 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 *************** *** 93,96 **** --- 103,152 ---- /** + * Constructor that defines the initial functions supported by this + * factory but doesn't use a superset factory. + * + * @param supportedFunctions a <code>Set</code> of <code>Function</code>s + * @param supportedAbstractFunctions a mapping from <code>URI</code> to + * <code>FunctionProxy</code> + */ + public BaseFunctionFactory(Set supportedFunctions, + Map supportedAbstractFunctions) { + this(null, supportedFunctions, 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 <code>BaseFunctionFactory(FunctionFactory)</code> + * and then manually add each function. + * + * @param superset the superset factory or null + * @param supportedFunctions a <code>Set</code> of <code>Function</code>s + * @param supportedAbstractFunctions a mapping from <code>URI</code> to + * <code>FunctionProxy</code> + */ + public BaseFunctionFactory(FunctionFactory superset, + Set supportedFunctions, + Map supportedAbstractFunctions) { + this(superset); + + Iterator it = supportedFunctions.iterator(); + while (it.hasNext()) { + Function function = (Function)(it.next()); + functionMap.put(function.getIdentifier().toString(), function); + } + + it = supportedAbstractFunctions.keySet().iterator(); + while (it.hasNext()) { + URI id = (URI)(it.next()); + FunctionProxy proxy = + (FunctionProxy)(supportedAbstractFunctions.get(id)); + functionMap.put(id.toString(), proxy); + } + } + + /** * Adds the function to the factory. Most functions have no state, so * the singleton model used here is typically desireable. The factory will |
From: Seth P. <se...@us...> - 2004-05-24 20:55:18
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16626/com/sun/xacml Modified Files: ConfigurationStore.java Log Message: re-factored so standard factories are immutable Index: ConfigurationStore.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ConfigurationStore.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConfigurationStore.java 13 May 2004 20:36:49 -0000 1.4 --- ConfigurationStore.java 24 May 2004 20:55:06 -0000 1.5 *************** *** 357,364 **** // check if we're starting with the standard factory setup ! if (useStandard(root, "useStandardDatatypes")) ! factory = StandardAttributeFactory.getNewFactory(); ! else factory = new BaseAttributeFactory(); // now look for all datatypes specified for this factory, adding --- 357,367 ---- // check if we're starting with the standard factory setup ! if (useStandard(root, "useStandardDatatypes")) { ! StandardAttributeFactory sf = ! StandardAttributeFactory.getFactory(); ! factory = new BaseAttributeFactory(sf.getStandardDatatypes()); ! } else { factory = new BaseAttributeFactory(); + } // now look for all datatypes specified for this factory, adding *************** *** 396,403 **** // check if we're starting with the standard factory setup ! if (useStandard(root, "useStandardAlgorithms")) ! factory = StandardCombiningAlgFactory.getNewFactory(); ! else factory = new BaseCombiningAlgFactory(); // now look for all algorithms specified for this factory, adding --- 399,409 ---- // check if we're starting with the standard factory setup ! if (useStandard(root, "useStandardAlgorithms")) { ! StandardCombiningAlgFactory sf = ! StandardCombiningAlgFactory.getFactory(); ! factory = new BaseCombiningAlgFactory(sf.getStandardAlgorithms()); ! } else { factory = new BaseCombiningAlgFactory(); + } // now look for all algorithms specified for this factory, adding *************** *** 441,445 **** // make sure that the proxy is pre-configured if (useStandard(root, "useStandardFunctions")) { ! proxy = StandardFunctionFactory.getNewFactory(); targetFactory = proxy.getTargetFactory(); --- 447,451 ---- // make sure that the proxy is pre-configured if (useStandard(root, "useStandardFunctions")) { ! proxy = StandardFunctionFactory.getNewFactoryProxy(); targetFactory = proxy.getTargetFactory(); |
From: Seth P. <se...@us...> - 2004-05-24 20:55:17
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16626/com/sun/xacml/combine Modified Files: BaseCombiningAlgFactory.java StandardCombiningAlgFactory.java Log Message: re-factored so standard factories are immutable Index: StandardCombiningAlgFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine/StandardCombiningAlgFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StandardCombiningAlgFactory.java 17 Mar 2004 18:03:38 -0000 1.3 --- StandardCombiningAlgFactory.java 24 May 2004 20:55:07 -0000 1.4 *************** *** 37,44 **** package com.sun.xacml.combine; /** * This factory supports the standard set of algorithms specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system. * * @since 1.2 --- 37,59 ---- package com.sun.xacml.combine; + import java.util.Collections; + import java.util.HashSet; + import java.util.Iterator; + import java.util.Set; + /** * This factory supports the standard set of algorithms specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system, and imposes ! * a singleton pattern insuring that there is only ever one instance of ! * this class. ! * <p> ! * Note that because this supports only the standard algorithms, this ! * factory does not allow the addition of any other algorithms. If you call ! * <code>addAlgorithm</code> on an instance of this class, an exception ! * will be thrown. If you need a standard factory that is modifiable, you ! * should create a new <code>BaseCombiningAlgFactory</code> (or some other ! * <code>CombiningAlgFactory</code>) and then configure it with the standard ! * algorithms using <code>getStandardAlgorithms</code>. * * @since 1.2 *************** *** 51,78 **** private static StandardCombiningAlgFactory factoryInstance = null; ! // dummy object used as a lock for the getFactory routine ! // FIXME: this needs a better mechanism ! private static Object factoryLock = new Object(); ! /** * Default constructor. */ private StandardCombiningAlgFactory() { ! addAlgorithm(new DenyOverridesRuleAlg()); ! addAlgorithm(new DenyOverridesPolicyAlg()); ! ! addAlgorithm(new OrderedDenyOverridesRuleAlg()); ! addAlgorithm(new OrderedDenyOverridesPolicyAlg()); ! ! addAlgorithm(new PermitOverridesRuleAlg()); ! addAlgorithm(new PermitOverridesPolicyAlg()); ! ! addAlgorithm(new OrderedPermitOverridesRuleAlg()); ! addAlgorithm(new OrderedPermitOverridesPolicyAlg()); ! ! addAlgorithm(new FirstApplicableRuleAlg()); ! addAlgorithm(new FirstApplicablePolicyAlg()); ! addAlgorithm(new OnlyOneApplicablePolicyAlg()); } --- 66,102 ---- private static StandardCombiningAlgFactory factoryInstance = null; ! // the algorithms supported by this factory ! private static Set supportedAlgorithms = null; ! /** * Default constructor. */ private StandardCombiningAlgFactory() { ! super(supportedAlgorithms); ! } ! /** ! * Private initializer for the supported algorithms. This isn't called ! * until something needs these values, and is only called once. ! */ ! private static void initAlgorithms() { ! supportedAlgorithms = new HashSet(); ! ! supportedAlgorithms.add(new DenyOverridesRuleAlg()); ! supportedAlgorithms.add(new DenyOverridesPolicyAlg()); ! ! supportedAlgorithms.add(new OrderedDenyOverridesRuleAlg()); ! supportedAlgorithms.add(new OrderedDenyOverridesPolicyAlg()); ! ! supportedAlgorithms.add(new PermitOverridesRuleAlg()); ! supportedAlgorithms.add(new PermitOverridesPolicyAlg()); ! ! supportedAlgorithms.add(new OrderedPermitOverridesRuleAlg()); ! supportedAlgorithms.add(new OrderedPermitOverridesPolicyAlg()); ! ! supportedAlgorithms.add(new FirstApplicableRuleAlg()); ! supportedAlgorithms.add(new FirstApplicablePolicyAlg()); ! ! supportedAlgorithms.add(new OnlyOneApplicablePolicyAlg()); } *************** *** 82,109 **** * the factory if it hasn't been requested before. This is the default * model used by the <code>CombiningAlgFactory</code>, ensuring quick ! * access to this factory. If you need a new instance of this factory ! * you should use the <code>getNewFactory</code> method. * * @return the factory instance */ ! public static CombiningAlgFactory getFactory() { if (factoryInstance == null) { ! synchronized (factoryLock) { ! if (factoryInstance == null) factoryInstance = new StandardCombiningAlgFactory(); } } ! return factoryInstance; } /** ! * Returns a new instance of <code>CombiningAlgFactory</code> that ! * supports all the standard algorithms. * ! * @return a new <code>StandardCombiningAlgFactory</code> */ ! public static CombiningAlgFactory getNewFactory() { ! return new StandardCombiningAlgFactory(); } --- 106,146 ---- * the factory if it hasn't been requested before. This is the default * model used by the <code>CombiningAlgFactory</code>, ensuring quick ! * access to this factory. * * @return the factory instance */ ! public static StandardCombiningAlgFactory getFactory() { if (factoryInstance == null) { ! synchronized (StandardCombiningAlgFactory.class) { ! if (factoryInstance == null) { ! initAlgorithms(); factoryInstance = new StandardCombiningAlgFactory(); + } } } ! return factoryInstance; } /** ! * Returns the set of algorithms that this standard factory supports. * ! * @return a <code>Set</code> of <code>CombiningAlgorithm</code>s */ ! public Set getStandardAlgorithms() { ! return Collections.unmodifiableSet(supportedAlgorithms); ! } ! ! /** ! * Throws an <code>UnsupportedOperationException</code> since you are not ! * allowed to modify what a standard factory supports. ! * ! * @param alg the combining algorithm to add ! * ! * @throws UnsupportedOperationException always ! */ ! public void addAlgorithm(CombiningAlgorithm alg) { ! throw new UnsupportedOperationException("a standard factory cannot " + ! "support new algorithms"); } Index: BaseCombiningAlgFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine/BaseCombiningAlgFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BaseCombiningAlgFactory.java 17 May 2004 20:33:45 -0000 1.3 --- BaseCombiningAlgFactory.java 24 May 2004 20:55:07 -0000 1.4 *************** *** 43,46 **** --- 43,47 ---- import java.util.Collections; import java.util.HashMap; + import java.util.Iterator; import java.util.Set; *************** *** 50,53 **** --- 51,62 ---- * implements the insertion and retrieval methods, but doesn't actually * setup the factory with any algorithms. + * <p> + * Note that while this class is thread-safe on all creation methods, it + * is not safe to add support for a new algorithm while creating an instance + * of an algorithm. 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 *************** *** 68,71 **** --- 77,106 ---- /** + * Constructor that configures this factory with an initial set of + * supported algorithms. + * + * @param algorithms a <code>Set</code> of + * </code>CombiningAlgorithm</code>s + * + * @throws IllegalArgumentException if any elements of the set are not + * </code>CombiningAlgorithm</code>s + */ + public BaseCombiningAlgFactory(Set algorithms) { + algMap = new HashMap(); + + Iterator it = algorithms.iterator(); + while (it.hasNext()) { + try { + CombiningAlgorithm alg = (CombiningAlgorithm)(it.next()); + algMap.put(alg.getIdentifier().toString(), alg); + } catch (ClassCastException cce) { + throw new IllegalArgumentException("an element of the set " + + "was not an instance of " + + "CombiningAlgorithm"); + } + } + } + + /** * Adds a combining algorithm to the factory. This single instance will * be returned to anyone who asks the factory for an algorithm with the *************** *** 74,78 **** * @param alg the combining algorithm to add * ! * @throws ProcessingException if the algId is already registered */ public void addAlgorithm(CombiningAlgorithm alg) { --- 109,113 ---- * @param alg the combining algorithm to add * ! * @throws IllegalArgumentException if the algId is already registered */ public void addAlgorithm(CombiningAlgorithm alg) { *************** *** 81,85 **** // check that the id doesn't already exist in the factory if (algMap.containsKey(algId)) ! throw new IllegalArgumentException("algorithm already registered"); // add the algorithm --- 116,121 ---- // check that the id doesn't already exist in the factory if (algMap.containsKey(algId)) ! throw new IllegalArgumentException("algorithm already registered: " ! + algId); // add the algorithm |
From: Seth P. <se...@us...> - 2004-05-24 20:55:16
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16626/com/sun/xacml/attr Modified Files: BaseAttributeFactory.java StandardAttributeFactory.java Log Message: re-factored so standard factories are immutable Index: StandardAttributeFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/StandardAttributeFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StandardAttributeFactory.java 17 Mar 2004 18:03:38 -0000 1.3 --- StandardAttributeFactory.java 24 May 2004 20:55:07 -0000 1.4 *************** *** 52,55 **** --- 52,60 ---- import com.sun.xacml.attr.proxy.X500NameAttributeProxy; + import java.util.Collections; + import java.util.HashMap; + import java.util.Iterator; + import java.util.Map; + import org.w3c.dom.Node; *************** *** 57,61 **** /** * This factory supports the standard set of datatypes specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system. * * @since 1.2 --- 62,76 ---- /** * This factory supports the standard set of datatypes specified in XACML ! * 1.0 and 1.1. It is the default factory used by the system, and imposes ! * a singleton pattern insuring that there is only ever one instance of ! * this class. ! * <p> ! * Note that because this supports only the standard datatypes, this ! * factory does not allow the addition of any other datatypes. If you call ! * <code>addDatatype</code> on an instance of this class, an exception ! * will be thrown. If you need a standard factory that is modifiable, you ! * should create a new <code>BaseAttributeFactory</code> (or some other ! * <code>AttributeFactory</code>) and then configure it with the standard ! * datatypes using <code>addStandardDatatypes</code>. * * @since 1.2 *************** *** 68,74 **** private static StandardAttributeFactory factoryInstance = null; ! // dummy object used as a lock for the getFactory routine ! // FIXME: this needs a better mechanism ! private static Object factoryLock = new Object(); /** --- 83,88 ---- private static StandardAttributeFactory factoryInstance = null; ! // the datatypes supported by this factory ! private static Map supportedDatatypes = null; /** *************** *** 77,101 **** */ private StandardAttributeFactory() { ! addDatatype(BooleanAttribute.identifier, new BooleanAttributeProxy()); ! addDatatype(StringAttribute.identifier, new StringAttributeProxy()); ! addDatatype(DateAttribute.identifier, new DateAttributeProxy()); ! addDatatype(TimeAttribute.identifier, new TimeAttributeProxy()); ! addDatatype(DateTimeAttribute.identifier, ! new DateTimeAttributeProxy()); ! addDatatype(DayTimeDurationAttribute.identifier, ! new DayTimeDurationAttributeProxy()); ! addDatatype(YearMonthDurationAttribute.identifier, ! new YearMonthDurationAttributeProxy()); ! addDatatype(DoubleAttribute.identifier, new DoubleAttributeProxy()); ! addDatatype(IntegerAttribute.identifier, new IntegerAttributeProxy()); ! addDatatype(AnyURIAttribute.identifier, new AnyURIAttributeProxy()); ! addDatatype(HexBinaryAttribute.identifier, ! new HexBinaryAttributeProxy()); ! addDatatype(Base64BinaryAttribute.identifier, ! new Base64BinaryAttributeProxy()); ! addDatatype(X500NameAttribute.identifier, ! new X500NameAttributeProxy()); ! addDatatype(RFC822NameAttribute.identifier, ! new RFC822NameAttributeProxy()); } --- 91,132 ---- */ private StandardAttributeFactory() { ! super(supportedDatatypes); ! } ! ! /** ! * Private initializer for the supported datatypes. This isn't called ! * until something needs these values, and is only called once. ! */ ! private static void initDatatypes() { ! supportedDatatypes = new HashMap(); ! ! supportedDatatypes.put(BooleanAttribute.identifier, ! new BooleanAttributeProxy()); ! supportedDatatypes.put(StringAttribute.identifier, ! new StringAttributeProxy()); ! supportedDatatypes.put(DateAttribute.identifier, ! new DateAttributeProxy()); ! supportedDatatypes.put(TimeAttribute.identifier, ! new TimeAttributeProxy()); ! supportedDatatypes.put(DateTimeAttribute.identifier, ! new DateTimeAttributeProxy()); ! supportedDatatypes.put(DayTimeDurationAttribute.identifier, ! new DayTimeDurationAttributeProxy()); ! supportedDatatypes.put(YearMonthDurationAttribute.identifier, ! new YearMonthDurationAttributeProxy()); ! supportedDatatypes.put(DoubleAttribute.identifier, ! new DoubleAttributeProxy()); ! supportedDatatypes.put(IntegerAttribute.identifier, ! new IntegerAttributeProxy()); ! supportedDatatypes.put(AnyURIAttribute.identifier, ! new AnyURIAttributeProxy()); ! supportedDatatypes.put(HexBinaryAttribute.identifier, ! new HexBinaryAttributeProxy()); ! supportedDatatypes.put(Base64BinaryAttribute.identifier, ! new Base64BinaryAttributeProxy()); ! supportedDatatypes.put(X500NameAttribute.identifier, ! new X500NameAttributeProxy()); ! supportedDatatypes.put(RFC822NameAttribute.identifier, ! new RFC822NameAttributeProxy()); } *************** *** 110,118 **** * @return the factory instance */ ! public static AttributeFactory getFactory() { if (factoryInstance == null) { ! synchronized (factoryLock) { ! if (factoryInstance == null) factoryInstance = new StandardAttributeFactory(); } } --- 141,151 ---- * @return the factory instance */ ! public static StandardAttributeFactory getFactory() { if (factoryInstance == null) { ! synchronized (StandardAttributeFactory.class) { ! if (factoryInstance == null) { ! initDatatypes(); factoryInstance = new StandardAttributeFactory(); + } } } *************** *** 122,132 **** /** ! * Returns a new instance of <code>AttributeFactory</code> that ! * supports all the standard datatypes. * ! * @return a new <code>StandardAttributeFactory</code> */ ! public static AttributeFactory getNewFactory() { ! return new StandardAttributeFactory(); } --- 155,179 ---- /** ! * Returns the set of datatypes that this standard factory supports. * ! * @return a <code>Map</code> of <code>String</code> to ! * <code>AttributeProxy</code>s */ ! public Map getStandardDatatypes() { ! return Collections.unmodifiableMap(supportedDatatypes); ! } ! ! /** ! * Throws an <code>UnsupportedOperationException</code> since you are not ! * allowed to modify what a standard factory supports. ! * ! * @param id the name of the attribute type ! * @param proxy the proxy used to create new attributes of the given type ! * ! * @throws UnsupportedOperationException always ! */ ! public void addDatatype(String id, AttributeProxy proxy) { ! throw new UnsupportedOperationException("a standard factory cannot " + ! "support new datatypes"); } Index: BaseAttributeFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/BaseAttributeFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BaseAttributeFactory.java 17 May 2004 20:33:45 -0000 1.3 --- BaseAttributeFactory.java 24 May 2004 20:55:07 -0000 1.4 *************** *** 44,47 **** --- 44,49 ---- import java.util.Collections; import java.util.HashMap; + import java.util.Iterator; + import java.util.Map; import java.util.Set; *************** *** 53,56 **** --- 55,66 ---- * implements the insertion and retrieval methods, but doesn't actually * setup the factory with any datatypes. + * <p> + * 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 *************** *** 71,74 **** --- 81,111 ---- /** + * Constructor that configures this factory with an initial set of + * supported datatypes. + * + * @param attributes a <code>Map</code> of <code>String</code>s to + * </code>AttributeProxy</code>s + * + * @throws IllegalArgumentException if any elements of the Map are not + * </code>AttributeProxy</code>s + */ + public BaseAttributeFactory(Map attributes) { + attributeMap = new HashMap(); + + Iterator it = attributes.keySet().iterator(); + while (it.hasNext()) { + try { + String id = (it.next()).toString(); + AttributeProxy proxy = (AttributeProxy)(attributes.get(id)); + attributeMap.put(id, proxy); + } catch (ClassCastException cce) { + throw new IllegalArgumentException("an element of the map " + + "was not an instance of " + + "AttributeProxy"); + } + } + } + + /** * Adds a proxy to the factory, which in turn will allow new attribute * types to be created using the factory. Typically the proxy is |
From: Seth P. <se...@us...> - 2004-05-17 20:34:49
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25674/com/sun/xacml/finder Modified Files: AttributeFinderModule.java PolicyFinderModule.java ResourceFinderModule.java Log Message: added a few new management methods Index: ResourceFinderModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/ResourceFinderModule.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ResourceFinderModule.java 30 Apr 2004 17:56:43 -0000 1.3 --- ResourceFinderModule.java 17 May 2004 20:34:37 -0000 1.4 *************** *** 55,58 **** --- 55,71 ---- /** + * Returns this module's identifier. A module does not need to provide + * a unique identifier, but it is a good idea, especially in support of + * management software. Common identifiers would be the full package + * and class name (the default if this method isn't overridden), just the + * class name, or some other well-known string that identifies this class. + * + * @return this module's identifier + */ + public String getIdentifier() { + return getClass().getName(); + } + + /** * Returns true if this module supports finding resources with the * "Children" scope. By default this method returns false. *************** *** 75,78 **** --- 88,113 ---- /** + * This is an experimental method that asks the module to invalidate any + * cache values it may contain. This is not used by any of the core + * processing code, but it may be used by management software that wants + * to have some control over these modules. Since a module is free to + * decide how or if it caches values, and whether it is capable of + * updating values once in a cache, a module is free to intrepret this + * message in any way it sees fit (including igoring the message). It + * is preferable, however, for a module to make every effort to clear + * any dynamically cached values it contains. + * <p> + * This method has been introduced to see what people think of this + * functionality, and how they would like to use it. It may be removed + * in future versions, or it may be changed to a more general + * message-passing system (if other useful messages are identified). + * + * @since 1.2 + */ + public void invalidateCache() { + + } + + /** * Tries to find the child Resource Ids associated with the parent. If * this module cannot handle the given identifier, then an empty result is Index: AttributeFinderModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/AttributeFinderModule.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AttributeFinderModule.java 12 May 2004 21:26:23 -0000 1.4 --- AttributeFinderModule.java 17 May 2004 20:34:37 -0000 1.5 *************** *** 63,66 **** --- 63,79 ---- /** + * Returns this module's identifier. A module does not need to provide + * a unique identifier, but it is a good idea, especially in support of + * management software. Common identifiers would be the full package + * and class name (the default if this method isn't overridden), just the + * class name, or some other well-known string that identifies this class. + * + * @return this module's identifier + */ + public String getIdentifier() { + return getClass().getName(); + } + + /** * Returns true if this module supports retrieving attributes based on the * data provided in an AttributeDesignatorType. By default this method *************** *** 112,115 **** --- 125,150 ---- /** + * This is an experimental method that asks the module to invalidate any + * cache values it may contain. This is not used by any of the core + * processing code, but it may be used by management software that wants + * to have some control over these modules. Since a module is free to + * decide how or if it caches values, and whether it is capable of + * updating values once in a cache, a module is free to intrepret this + * message in any way it sees fit (including igoring the message). It + * is preferable, however, for a module to make every effort to clear + * any dynamically cached values it contains. + * <p> + * This method has been introduced to see what people think of this + * functionality, and how they would like to use it. It may be removed + * in future versions, or it may be changed to a more general + * message-passing system (if other useful messages are identified). + * + * @since 1.2 + */ + public void invalidateCache() { + + } + + /** * Tries to find attribute values based on the given designator data. * The result, if successful, must always contain a Index: PolicyFinderModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/PolicyFinderModule.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PolicyFinderModule.java 17 Mar 2004 18:03:39 -0000 1.2 --- PolicyFinderModule.java 17 May 2004 20:34:37 -0000 1.3 *************** *** 55,58 **** --- 55,71 ---- /** + * Returns this module's identifier. A module does not need to provide + * a unique identifier, but it is a good idea, especially in support of + * management software. Common identifiers would be the full package + * and class name (the default if this method isn't overridden), just the + * class name, or some other well-known string that identifies this class. + * + * @return this module's identifier + */ + public String getIdentifier() { + return getClass().getName(); + } + + /** * Returns true if the module supports finding policies based on a * request (ie, target matching). By default this method returns false. *************** *** 75,83 **** --- 88,128 ---- /** + * Initializes this module for use by the given finder. Typically this + * is called when a <code>PDP</code> is initialized with a + * <code>PDPConfig</code> containing the given <code>PolicyFinder</code>. + * Because <code>PolicyFinderModule</code>s usually need to parse + * policies, and this requires knowing their <code>PolicyFinder<code>, + * parsing is usually done at or after this point in the lifetime + * of this module. This might also be a good time to reset any internal + * caches or temporary data. Note that this method may be called more + * than once in the lifetime of a module. * + * @param finder the <code>PolicyFinder</code> using this module */ public abstract void init(PolicyFinder finder); /** + * This is an experimental method that asks the module to invalidate any + * cache values it may contain. This is not used by any of the core + * processing code, but it may be used by management software that wants + * to have some control over these modules. Since a module is free to + * decide how or if it caches values, and whether it is capable of + * updating values once in a cache, a module is free to intrepret this + * message in any way it sees fit (including igoring the message). It + * is preferable, however, for a module to make every effort to clear + * any dynamically cached values it contains. + * <p> + * This method has been introduced to see what people think of this + * functionality, and how they would like to use it. It may be removed + * in future versions, or it may be changed to a more general + * message-passing system (if other useful messages are identified). + * + * @since 1.2 + */ + public void invalidateCache() { + + } + + /** * Tries to find one and only one matching policy given the request * represented by the context data. If more than one policy is found, |
From: Seth P. <se...@us...> - 2004-05-17 20:33:57
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25375/com/sun/xacml/cond Modified Files: BaseFunctionFactory.java FunctionFactory.java Log Message: added a method that returns the supported identifiers Index: FunctionFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/FunctionFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FunctionFactory.java 17 Mar 2004 18:03:38 -0000 1.6 --- FunctionFactory.java 17 May 2004 20:33:45 -0000 1.7 *************** *** 42,45 **** --- 42,47 ---- import java.net.URI; + import java.util.Set; + import org.w3c.dom.Node; *************** *** 279,282 **** --- 281,291 ---- /** + * Returns the function identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public abstract Set getSupportedFunctions(); + + /** * Tries to get an instance of the specified function. * Index: BaseFunctionFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/BaseFunctionFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BaseFunctionFactory.java 17 Mar 2004 18:03:38 -0000 1.2 --- BaseFunctionFactory.java 17 May 2004 20:33:45 -0000 1.3 *************** *** 43,46 **** --- 43,48 ---- import java.util.HashMap; + import java.util.HashSet; + import java.util.Set; import org.w3c.dom.Node; *************** *** 151,154 **** --- 153,170 ---- /** + * Returns the function identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public Set getSupportedFunctions() { + Set set = new HashSet(functionMap.keySet()); + + if (superset != null) + set.addAll(superset.getSupportedFunctions()); + + return set; + } + + /** * Tries to get an instance of the specified function. * |
From: Seth P. <se...@us...> - 2004-05-17 20:33:57
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25375/com/sun/xacml/attr Modified Files: AttributeFactory.java BaseAttributeFactory.java Log Message: added a method that returns the supported identifiers Index: BaseAttributeFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/BaseAttributeFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BaseAttributeFactory.java 17 Mar 2004 18:03:38 -0000 1.2 --- BaseAttributeFactory.java 17 May 2004 20:33:45 -0000 1.3 *************** *** 42,46 **** --- 42,48 ---- import java.net.URI; + import java.util.Collections; import java.util.HashMap; + import java.util.Set; import org.w3c.dom.Node; *************** *** 87,90 **** --- 89,101 ---- /** + * Returns the datatype identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public Set getSupportedDatatypes() { + return Collections.unmodifiableSet(attributeMap.keySet()); + } + + /** * 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 Index: AttributeFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AttributeFactory.java 17 Mar 2004 18:03:38 -0000 1.6 --- AttributeFactory.java 17 May 2004 20:33:45 -0000 1.7 *************** *** 42,45 **** --- 42,47 ---- import java.net.URI; + import java.util.Set; + import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; *************** *** 138,141 **** --- 140,150 ---- /** + * Returns the datatype identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public abstract Set getSupportedDatatypes(); + + /** * 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 XAML attribute |
From: Seth P. <se...@us...> - 2004-05-17 20:33:57
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25375/com/sun/xacml/combine Modified Files: BaseCombiningAlgFactory.java CombiningAlgFactory.java Log Message: added a method that returns the supported identifiers Index: CombiningAlgFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine/CombiningAlgFactory.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CombiningAlgFactory.java 17 Mar 2004 18:03:38 -0000 1.8 --- CombiningAlgFactory.java 17 May 2004 20:33:45 -0000 1.9 *************** *** 41,44 **** --- 41,46 ---- import java.net.URI; + import java.util.Set; + /** *************** *** 127,130 **** --- 129,139 ---- /** + * Returns the algorithm identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public abstract Set getSupportedAlgorithms(); + + /** * Tries to return the correct combinging algorithm based on the * given algorithm ID. Index: BaseCombiningAlgFactory.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/combine/BaseCombiningAlgFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BaseCombiningAlgFactory.java 17 Mar 2004 18:03:38 -0000 1.2 --- BaseCombiningAlgFactory.java 17 May 2004 20:33:45 -0000 1.3 *************** *** 41,45 **** --- 41,47 ---- import java.net.URI; + import java.util.Collections; import java.util.HashMap; + import java.util.Set; *************** *** 86,89 **** --- 88,100 ---- /** + * Returns the algorithm identifiers supported by this factory. + * + * @return a <code>Set</code> of <code>String</code>s + */ + public Set getSupportedAlgorithms() { + return Collections.unmodifiableSet(algMap.keySet()); + } + + /** * Tries to return the correct combinging algorithm based on the * given algorithm ID. |
From: Seth P. <se...@us...> - 2004-05-14 20:43:17
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31302/com/sun/xacml/cond Modified Files: Apply.java Evaluatable.java Log Message: added getChildren to Evaluatable to make it easier to walk the Condition tree Index: Apply.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/Apply.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Apply.java 17 Mar 2004 18:03:38 -0000 1.7 --- Apply.java 14 May 2004 20:43:07 -0000 1.8 *************** *** 130,134 **** // if everything checks out, then store the inputs this.function = function; ! this.evals = Collections.unmodifiableList(evals); this.bagFunction = bagFunction; this.isCondition = isCondition; --- 130,134 ---- // if everything checks out, then store the inputs this.function = function; ! this.evals = Collections.unmodifiableList(new ArrayList(evals)); this.bagFunction = bagFunction; this.isCondition = isCondition; *************** *** 275,279 **** * Returns the <code>List</code> of children for this <code>Apply</code>. * The <code>List</code> contains <code>Evaluatable</code>s. The list is ! * unmodifiable. * * @return a <code>List</code> of <code>Evaluatable</code>s --- 275,279 ---- * Returns the <code>List</code> of children for this <code>Apply</code>. * The <code>List</code> contains <code>Evaluatable</code>s. The list is ! * unmodifiable, and may be empty. * * @return a <code>List</code> of <code>Evaluatable</code>s Index: Evaluatable.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/Evaluatable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Evaluatable.java 17 Mar 2004 18:03:38 -0000 1.3 --- Evaluatable.java 14 May 2004 20:43:07 -0000 1.4 *************** *** 46,49 **** --- 46,51 ---- import java.net.URI; + import java.util.List; + /** *************** *** 86,89 **** --- 88,100 ---- /** + * Returns all children, in order, of this element in the Condition + * tree, or en empty set if this element has no children. In XACML 1.x, + * only the ApplyType ever has children. + * + * @return a <code>List</code> of <code>Evaluatable</code>s + */ + public List getChildren(); + + /** * Encodes this <code>Evaluatable</code> into its XML representation and * writes this encoding to the given <code>OutputStream</code> with no |
From: Seth P. <se...@us...> - 2004-05-14 20:43:16
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31302/com/sun/xacml/attr Modified Files: AttributeDesignator.java AttributeSelector.java AttributeValue.java Log Message: added getChildren to Evaluatable to make it easier to walk the Condition tree Index: AttributeDesignator.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeDesignator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AttributeDesignator.java 17 Mar 2004 18:03:38 -0000 1.5 --- AttributeDesignator.java 14 May 2004 20:43:07 -0000 1.6 *************** *** 56,59 **** --- 56,60 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.Iterator; import java.util.List; *************** *** 323,326 **** --- 324,336 ---- /** + * Always returns an empty list since designators never have children. + * + * @return an empty <code>List</code> + */ + public List getChildren() { + return Collections.EMPTY_LIST; + } + + /** * Evaluates the pre-assigned meta-data against the given context, * trying to find some matching values. Index: AttributeValue.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeValue.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AttributeValue.java 17 Mar 2004 18:03:38 -0000 1.5 --- AttributeValue.java 14 May 2004 20:43:07 -0000 1.6 *************** *** 48,51 **** --- 48,54 ---- import java.net.URI; + import java.util.Collections; + import java.util.List; + /** *************** *** 100,103 **** --- 103,115 ---- /** + * Always returns an empty list since values never have children. + * + * @return an empty <code>List</code> + */ + public List getChildren() { + return Collections.EMPTY_LIST; + } + + /** * Returns whether or not this value is actually a bag of values. By * default this returns <code>false</code>. Typically, only the Index: AttributeSelector.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeSelector.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AttributeSelector.java 12 May 2004 21:27:20 -0000 1.8 --- AttributeSelector.java 14 May 2004 20:43:07 -0000 1.9 *************** *** 52,55 **** --- 52,57 ---- import java.util.ArrayList; + import java.util.Collections; + import java.util.List; import org.w3c.dom.NamedNodeMap; *************** *** 240,243 **** --- 242,254 ---- /** + * Always returns an empty list since selectors never have children. + * + * @return an empty <code>List</code> + */ + public List getChildren() { + return Collections.EMPTY_LIST; + } + + /** * Returns the XPath version this selector is supposed to use. This is * typically provided by the defaults section of the policy containing |
From: Seth P. <se...@us...> - 2004-05-14 18:46:40
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/ctx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3314/com/sun/xacml/ctx Modified Files: RequestCtx.java ResponseCtx.java Status.java Subject.java Log Message: updated to make all incoming/outgoing collections copied and immutable Index: Subject.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ctx/Subject.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Subject.java 17 Mar 2004 18:03:39 -0000 1.2 --- Subject.java 14 May 2004 18:46:23 -0000 1.3 *************** *** 47,50 **** --- 47,51 ---- import java.util.Collections; + import java.util.HashSet; import java.util.Set; *************** *** 121,125 **** this.category = category; ! this.attributes = Collections.unmodifiableSet(attributes); } --- 122,126 ---- this.category = category; ! this.attributes = Collections.unmodifiableSet(new HashSet(attributes)); } Index: RequestCtx.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ctx/RequestCtx.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RequestCtx.java 17 Mar 2004 18:03:39 -0000 1.7 --- RequestCtx.java 14 May 2004 18:46:23 -0000 1.8 *************** *** 51,54 **** --- 51,55 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.HashSet; import java.util.Iterator; *************** *** 165,169 **** "well formed"); } ! this.subjects = new HashSet(subjects); // make sure resource is well formed --- 166,170 ---- "well formed"); } ! this.subjects = Collections.unmodifiableSet(new HashSet(subjects)); // make sure resource is well formed *************** *** 174,178 **** "well formed"); } ! this.resource = new HashSet(resource); // make sure action is well formed --- 175,179 ---- "well formed"); } ! this.resource = Collections.unmodifiableSet(new HashSet(resource)); // make sure action is well formed *************** *** 183,187 **** "well formed"); } ! this.action = new HashSet(action); // make sure environment is well formed --- 184,188 ---- "well formed"); } ! this.action = Collections.unmodifiableSet(new HashSet(action)); // make sure environment is well formed *************** *** 192,196 **** " well formed"); } ! this.environment = new HashSet(environment); this.documentRoot = documentRoot; --- 193,198 ---- " well formed"); } ! this.environment = ! Collections.unmodifiableSet(new HashSet(environment)); this.documentRoot = documentRoot; Index: ResponseCtx.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ctx/ResponseCtx.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ResponseCtx.java 17 Mar 2004 18:03:39 -0000 1.3 --- ResponseCtx.java 14 May 2004 18:46:23 -0000 1.4 *************** *** 45,48 **** --- 45,49 ---- import java.io.PrintStream; + import java.util.Collections; import java.util.HashSet; import java.util.Iterator; *************** *** 90,94 **** */ public ResponseCtx(Set results) { ! this.results = new HashSet(results); } --- 91,95 ---- */ public ResponseCtx(Set results) { ! this.results = Collections.unmodifiableSet(new HashSet(results)); } Index: Status.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ctx/Status.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Status.java 17 Mar 2004 18:03:39 -0000 1.3 --- Status.java 14 May 2004 18:46:23 -0000 1.4 *************** *** 46,49 **** --- 46,50 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.Iterator; import java.util.List; *************** *** 165,169 **** } ! this.code = new ArrayList(code); this.message = message; this.detail = detail; --- 166,170 ---- } ! this.code = Collections.unmodifiableList(new ArrayList(code)); this.message = message; this.detail = detail; *************** *** 176,180 **** */ public List getCode() { ! return new ArrayList(code); } --- 177,181 ---- */ public List getCode() { ! return code; } |
From: Seth P. <se...@us...> - 2004-05-14 18:46:39
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3314/com/sun/xacml/finder Modified Files: PolicyFinder.java ResourceFinderResult.java Log Message: updated to make all incoming/outgoing collections copied and immutable Index: PolicyFinder.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/PolicyFinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PolicyFinder.java 17 Mar 2004 18:03:39 -0000 1.2 --- PolicyFinder.java 14 May 2004 18:46:23 -0000 1.3 *************** *** 95,99 **** */ public Set getModules() { ! return allModules; } --- 95,99 ---- */ public Set getModules() { ! return new HashSet(allModules); } Index: ResourceFinderResult.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/ResourceFinderResult.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ResourceFinderResult.java 17 Mar 2004 18:03:39 -0000 1.2 --- ResourceFinderResult.java 14 May 2004 18:46:24 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- package com.sun.xacml.finder; + import java.util.Collections; import java.util.HashMap; import java.util.HashSet; *************** *** 69,74 **** */ public ResourceFinderResult() { ! resources = new HashSet(); ! failures = new HashMap(); empty = true; } --- 70,75 ---- */ public ResourceFinderResult() { ! resources = Collections.unmodifiableSet(new HashSet()); ! failures = Collections.unmodifiableMap(new HashMap()); empty = true; } *************** *** 115,120 **** */ public ResourceFinderResult(Set resources, Map failures) { ! this.resources = resources; ! this.failures = failures; empty = false; } --- 116,121 ---- */ public ResourceFinderResult(Set resources, Map failures) { ! this.resources = Collections.unmodifiableSet(new HashSet(resources)); ! this.failures = Collections.unmodifiableMap(new HashMap(failures)); empty = false; } |
From: Seth P. <se...@us...> - 2004-05-14 18:46:34
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3314/com/sun/xacml Modified Files: AbstractPolicy.java Obligation.java Target.java Log Message: updated to make all incoming/outgoing collections copied and immutable Index: Obligation.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/Obligation.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Obligation.java 23 Mar 2004 22:59:48 -0000 1.6 --- Obligation.java 14 May 2004 18:46:22 -0000 1.7 *************** *** 50,53 **** --- 50,54 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.Iterator; import java.util.List; *************** *** 89,93 **** this.id = id; this.fulfillOn = fulfillOn; ! this.assignments = assignments; } --- 90,95 ---- this.id = id; this.fulfillOn = fulfillOn; ! this.assignments = Collections. ! unmodifiableList(new ArrayList(assignments)); } Index: Target.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/Target.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Target.java 17 Mar 2004 18:03:37 -0000 1.6 --- Target.java 14 May 2004 18:46:22 -0000 1.7 *************** *** 85,99 **** this.subjects = subjects; else ! this.subjects = Collections.unmodifiableList(subjects); if (resources == null) this.resources = resources; else ! this.resources = Collections.unmodifiableList(resources); if (actions == null) this.actions = actions; else ! this.actions = Collections.unmodifiableList(actions); } --- 85,102 ---- this.subjects = subjects; else ! this.subjects = Collections. ! unmodifiableList(new ArrayList(subjects)); if (resources == null) this.resources = resources; else ! this.resources = Collections. ! unmodifiableList(new ArrayList(resources)); if (actions == null) this.actions = actions; else ! this.actions = Collections. ! unmodifiableList(new ArrayList(actions)); } Index: AbstractPolicy.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/AbstractPolicy.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractPolicy.java 17 Mar 2004 18:03:37 -0000 1.9 --- AbstractPolicy.java 14 May 2004 18:46:21 -0000 1.10 *************** *** 152,156 **** this.obligations = Collections.EMPTY_SET; else ! this.obligations = Collections.unmodifiableSet(obligations); } --- 152,157 ---- this.obligations = Collections.EMPTY_SET; else ! this.obligations = Collections. ! unmodifiableSet(new HashSet(obligations)); } |
From: Seth P. <se...@us...> - 2004-05-14 18:42:12
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2563/com/sun/xacml/finder/impl Modified Files: SelectorModule.java Log Message: removed a printout Index: SelectorModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl/SelectorModule.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SelectorModule.java 12 May 2004 21:25:10 -0000 1.7 --- SelectorModule.java 14 May 2004 18:42:03 -0000 1.8 *************** *** 192,196 **** try { // NOTE: see comments in XALAN docs about why this is slow - System.out.println("asking for: " + rootPath + path); matches = XPathAPI.selectNodeList(root, rootPath + path, nsNode); } catch (Exception e) { --- 192,195 ---- |
From: Seth P. <se...@us...> - 2004-05-13 20:36:57
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7067/com/sun/xacml Modified Files: ConfigurationStore.java Log Message: updated the javadocs Index: ConfigurationStore.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/ConfigurationStore.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConfigurationStore.java 26 Apr 2004 16:46:18 -0000 1.3 --- ConfigurationStore.java 13 May 2004 20:36:49 -0000 1.4 *************** *** 101,105 **** * but also has the convenience of re-using a common configuration * mechanism. See http://sunxacml.sourceforge.net/schama/config-0.2.xsd for ! * the valid schama. * <p> * Note that becuase this doesn't tie directly into the rest of the code, you --- 101,105 ---- * but also has the convenience of re-using a common configuration * mechanism. See http://sunxacml.sourceforge.net/schama/config-0.2.xsd for ! * the valid schema. * <p> * Note that becuase this doesn't tie directly into the rest of the code, you |
From: Seth P. <se...@us...> - 2004-05-12 21:27:31
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17329/com/sun/xacml/attr Modified Files: AttributeSelector.java Log Message: updated to provide namespace mapping node Index: AttributeSelector.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/attr/AttributeSelector.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AttributeSelector.java 6 May 2004 21:10:35 -0000 1.7 --- AttributeSelector.java 12 May 2004 21:27:20 -0000 1.8 *************** *** 81,86 **** private String xpathVersion; /** ! * Creates a new <code>AttributeSelector</code>. * * @param type the data type of the attribute values this selector --- 81,89 ---- private String xpathVersion; + // the policy root, where we get namespace mapping details + private Node policyRoot; + /** ! * Creates a new <code>AttributeSelector</code> with no policy root. * * @param type the data type of the attribute values this selector *************** *** 91,102 **** * XPath version string (the identifier for XPath 1.0 * is provided in <code>AbstractPolicy</code>) - * */ public AttributeSelector(URI type, String contextPath, boolean mustBePresent, String xpathVersion) { this.type = type; this.contextPath = contextPath; this.mustBePresent = mustBePresent; this.xpathVersion = xpathVersion; } --- 94,123 ---- * XPath version string (the identifier for XPath 1.0 * is provided in <code>AbstractPolicy</code>) */ public AttributeSelector(URI type, String contextPath, boolean mustBePresent, String xpathVersion) { + this(type, contextPath, null, mustBePresent, xpathVersion); + } + + /** + * Creates a new <code>AttributeSelector</code>. + * + * @param type the data type of the attribute values this selector + * looks for + * @param contextPath the XPath to query + * @param policyRoot the root DOM Element for the policy containing this + * selector, which defines namespace mappings + * @param mustBePresent must resolution find a match + * @param xpathVersion the XPath version to use, which must be a valid + * XPath version string (the identifier for XPath 1.0 + * is provided in <code>AbstractPolicy</code>) + */ + public AttributeSelector(URI type, String contextPath, Node policyRoot, + boolean mustBePresent, String xpathVersion) { this.type = type; this.contextPath = contextPath; this.mustBePresent = mustBePresent; this.xpathVersion = xpathVersion; + this.policyRoot = policyRoot; } *************** *** 162,167 **** } ! return new AttributeSelector(type, contextPath, mustBePresent, ! xpathVersion); } --- 183,201 ---- } ! // as of 1.2 we need the root element of the policy so we can get ! // the namespace mapping, but in order to leave the APIs unchanged, ! // we'll walk up the tree to find the root rather than pass this ! // element around through all the code ! Node policyRoot = null; ! Node node = root.getParentNode(); ! ! while ((node != null) && (node.getNodeType() == Node.ELEMENT_NODE)) { ! policyRoot = node; ! node = node.getParentNode(); ! } ! ! // create the new selector ! return new AttributeSelector(type, contextPath, policyRoot, ! mustBePresent, xpathVersion); } *************** *** 234,239 **** public EvaluationResult evaluate(EvaluationCtx context) { // query the context ! EvaluationResult result = context.getAttribute(contextPath, type, ! xpathVersion); // see if we got anything --- 268,273 ---- public EvaluationResult evaluate(EvaluationCtx context) { // query the context ! EvaluationResult result = context.getAttribute(contextPath, policyRoot, ! type, xpathVersion); // see if we got anything |
From: Seth P. <se...@us...> - 2004-05-12 21:27:30
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17329/com/sun/xacml Modified Files: BasicEvaluationCtx.java EvaluationCtx.java Log Message: updated to provide namespace mapping node Index: BasicEvaluationCtx.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/BasicEvaluationCtx.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicEvaluationCtx.java 3 May 2004 18:33:35 -0000 1.1 --- BasicEvaluationCtx.java 12 May 2004 21:27:20 -0000 1.2 *************** *** 629,632 **** --- 629,634 ---- * * @param contextPath the XPath expression to search + * @param namespaceNode the DOM node defining namespace mappings to use, + * or null if mappings come from the context root * @param type the type of the attribute value(s) to find * @param xpathVersion the version of XPath to use *************** *** 636,642 **** * Indeterminate result */ ! public EvaluationResult getAttribute(String contextPath, URI type, String xpathVersion) { ! return finder.findAttribute(contextPath, type, this, xpathVersion); } --- 638,646 ---- * Indeterminate result */ ! public EvaluationResult getAttribute(String contextPath, ! Node namespaceNode, URI type, String xpathVersion) { ! return finder.findAttribute(contextPath, namespaceNode, type, this, ! xpathVersion); } Index: EvaluationCtx.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/EvaluationCtx.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EvaluationCtx.java 3 May 2004 18:33:35 -0000 1.7 --- EvaluationCtx.java 12 May 2004 21:27:20 -0000 1.8 *************** *** 275,278 **** --- 275,280 ---- * * @param contextPath the XPath expression to search + * @param namespaceNode the DOM node defining namespace mappings to use, + * or null if mappings come from the context root * @param type the type of the attribute value(s) to find * @param xpathVersion the version of XPath to use *************** *** 282,286 **** * Indeterminate result */ ! public EvaluationResult getAttribute(String contextPath, URI datatype, String xpathVersion); --- 284,289 ---- * Indeterminate result */ ! public EvaluationResult getAttribute(String contextPath, ! Node namespaceNode, URI datatype, String xpathVersion); |
From: Seth P. <se...@us...> - 2004-05-12 21:26:33
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17109/com/sun/xacml/finder Modified Files: AttributeFinder.java AttributeFinderModule.java Log Message: changed XPath interface to accept a DOM node for namespace definitions Index: AttributeFinder.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/AttributeFinder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeFinder.java 17 Mar 2004 18:03:39 -0000 1.3 --- AttributeFinder.java 12 May 2004 21:26:23 -0000 1.4 *************** *** 50,53 **** --- 50,55 ---- import java.util.Set; + import org.w3c.dom.Node; + /** *************** *** 188,191 **** --- 190,195 ---- * * @param contextPath the XPath expression to search against + * @param namespaceNode the DOM node defining namespace mappings to use, + * or null if mappings come from the context root * @param attributeType the datatype of the attributes to find * @param context the representation of the request data *************** *** 196,199 **** --- 200,204 ---- */ public EvaluationResult findAttribute(String contextPath, + Node namespaceNode, URI attributeType, EvaluationCtx context, *************** *** 207,212 **** // see if the module can find an attribute value EvaluationResult result = ! module.findAttribute(contextPath, attributeType, context, ! xpathVersion); // if there was an error, we stop right away --- 212,217 ---- // see if the module can find an attribute value EvaluationResult result = ! module.findAttribute(contextPath, namespaceNode, attributeType, ! context, xpathVersion); // if there was an error, we stop right away Index: AttributeFinderModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/AttributeFinderModule.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AttributeFinderModule.java 17 Mar 2004 18:03:39 -0000 1.3 --- AttributeFinderModule.java 12 May 2004 21:26:23 -0000 1.4 *************** *** 47,50 **** --- 47,52 ---- import java.util.Set; + import org.w3c.dom.Node; + /** *************** *** 148,151 **** --- 150,155 ---- * * @param contextPath the XPath expression to search against + * @param namespaceNode the DOM node defining namespace mappings to use, + * or null if mappings come from the context root * @param attributeType the datatype of the attributes to find * @param context the representation of the request data *************** *** 156,159 **** --- 160,164 ---- */ public EvaluationResult findAttribute(String contextPath, + Node namespaceNode, URI attributeType, EvaluationCtx context, |
From: Seth P. <se...@us...> - 2004-05-12 21:25:21
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/com/sun/xacml/finder/impl Modified Files: SelectorModule.java Log Message: fixed namespace mapping to use policy namespace definitions Index: SelectorModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl/SelectorModule.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SelectorModule.java 17 Mar 2004 18:03:39 -0000 1.6 --- SelectorModule.java 12 May 2004 21:25:10 -0000 1.7 *************** *** 57,60 **** --- 57,61 ---- import org.apache.xpath.XPathAPI; + import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; *************** *** 64,72 **** * This module implements the basic behavior of the AttributeSelectorType, * looking for attribute values in the physical request document using the ! * given XPath expression. This is implemented as a separate module instead ! * of in the core code (like the designator code) so that programmers can ! * remove this functionality if they want (it's optional in the spec), so ! * they can replace this code with more efficient, specific code as needed, ! * and so they can easily swap in different XPath libraries. * <p> * Note that if no matches are found, this module will return an empty bag --- 65,73 ---- * This module implements the basic behavior of the AttributeSelectorType, * looking for attribute values in the physical request document using the ! * given XPath expression. This is implemented as a separate module (instead ! * of being implemented directly in <code>AttributeSelector</code> so that ! * programmers can remove this functionality if they want (it's optional in ! * the spec), so they can replace this code with more efficient, specific ! * code as needed, and so they can easily swap in different XPath libraries. * <p> * Note that if no matches are found, this module will return an empty bag *************** *** 76,80 **** * <p> * This module uses the Xalan XPath implementation, and supports only version ! * 1.0 of XPath. * * @since 1.0 --- 77,84 ---- * <p> * This module uses the Xalan XPath implementation, and supports only version ! * 1.0 of XPath. It is a fully functional, correct implementation of XACML's ! * AttributeSelector functionality, but is not designed for environments ! * that make significant use of XPath queries. Developers for any such ! * environment should consider implementing their own module. * * @since 1.0 *************** *** 110,113 **** --- 114,119 ---- * * @param path the XPath expression to search against + * @param namespaceNode the DOM node defining namespace mappings to use, + * or null if mappings come from the context root * @param type the datatype of the attributes to find * @param context the representation of the request data *************** *** 117,122 **** * attributes or an error */ ! public EvaluationResult findAttribute(String path, URI type, ! EvaluationCtx context, String xpathVersion) { // we only support 1.0 --- 123,128 ---- * attributes or an error */ ! public EvaluationResult findAttribute(String path, Node namespaceNode, ! URI type, EvaluationCtx context, String xpathVersion) { // we only support 1.0 *************** *** 126,134 **** // get the DOM root of the request document Node root = context.getRequestRoot(); ! NodeList matches = null; try { // NOTE: see comments in XALAN docs about why this is slow ! matches = XPathAPI.selectNodeList(root, path); } catch (Exception e) { // in the case of any exception, we need to return an error --- 132,197 ---- // get the DOM root of the request document Node root = context.getRequestRoot(); ! ! // if we were provided with a non-null namespace node, then use it ! // to resolve namespaces, otherwise use the context root node ! Node nsNode = (namespaceNode != null) ? namespaceNode : root; ! ! // setup the root path (pre-pended to the context path), which... ! String rootPath = ""; ! ! // ...only has content if the context path is relative ! if (path.charAt(0) != '/') { ! String rootName = root.getLocalName(); ! ! // see if the request root is in a namespace ! String namespace = root.getNamespaceURI(); ! ! if (namespace == null) { ! // no namespacing, so we're done ! rootPath = "/" + rootName + "/"; ! } else { ! // namespaces are used, so we need to lookup the correct ! // prefix to use in the search string ! NamedNodeMap nmap = namespaceNode.getAttributes(); ! rootPath = null; ! ! for (int i = 0; i < nmap.getLength(); i++) { ! Node n = nmap.item(i); ! if (n.getNodeValue().equals(namespace)) { ! // we found the matching namespace, so get the prefix ! // and then break out ! String name = n.getNodeName(); ! int pos = name.indexOf(':'); ! ! if (pos == -1) { ! // the namespace was the default namespace ! rootPath = "/"; ! } else { ! // we found a prefixed namespace ! rootPath = "/" + name.substring(pos + 1); ! } ! ! // finish off the string ! rootPath += ":" + rootName + "/"; ! ! break; ! } ! } ! ! // if the rootPath is still null, then we don't have any ! // definitions for the namespace ! if (rootPath == null) { ! // FIXME: should this be an error, or should we add ! // the namespace somehow? ! } ! } ! } ! ! // now do the query, pre-pending the root path to the context path NodeList matches = null; try { // NOTE: see comments in XALAN docs about why this is slow ! System.out.println("asking for: " + rootPath + path); ! matches = XPathAPI.selectNodeList(root, rootPath + path, nsNode); } catch (Exception e) { // in the case of any exception, we need to return an error |
From: Seth P. <se...@us...> - 2004-05-12 21:23:53
|
Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16496/com/sun/xacml/finder/impl Modified Files: FilePolicyModule.java Log Message: made the parser namespace-aware in all cases Index: FilePolicyModule.java =================================================================== RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/finder/impl/FilePolicyModule.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FilePolicyModule.java 17 Mar 2004 18:03:39 -0000 1.4 --- FilePolicyModule.java 12 May 2004 21:23:44 -0000 1.5 *************** *** 252,259 **** DocumentBuilder db = null; // set the factory to work the way the system requires if (schemaFile == null) { // we're not doing any validation - factory.setNamespaceAware(false); factory.setValidating(false); --- 252,261 ---- DocumentBuilder db = null; + // as of 1.2, we always are namespace aware + factory.setNamespaceAware(true); + // set the factory to work the way the system requires if (schemaFile == null) { // we're not doing any validation factory.setValidating(false); *************** *** 261,265 **** } else { // we're using a validating parser - factory.setNamespaceAware(true); factory.setValidating(true); --- 263,266 ---- |