Update of /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30273/com/sun/xacml/cond
Modified Files:
BagFunction.java ConditionBagFunction.java
ConditionSetFunction.java EqualFunction.java
FunctionFactory.java GeneralBagFunction.java
GeneralSetFunction.java MatchFunction.java SetFunction.java
StandardFunctionFactory.java
Added Files:
StringFunction.java URLStringCatFunction.java
Log Message:
Added support for the XACML 2.0 functions, cleaned up current env handling
and date/time construction, and made most of the factory-related changes
to support the promised 2.0 features
Index: GeneralBagFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/GeneralBagFunction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** GeneralBagFunction.java 24 May 2004 21:39:22 -0000 1.4
--- GeneralBagFunction.java 13 Jan 2006 22:32:51 -0000 1.5
***************
*** 3,7 ****
* @(#)GeneralBagFunction.java
*
! * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)GeneralBagFunction.java
*
! * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 95,98 ****
--- 95,116 ----
baseType, true));
}
+
+ for (int i = 0; i < baseTypes2.length; i++) {
+ String baseType = baseTypes2[i];
+ String functionBaseName = FUNCTION_NS_2 + simpleTypes2[i];
+
+ paramMap.put(functionBaseName + NAME_BASE_ONE_AND_ONLY,
+ new BagParameters(ID_BASE_ONE_AND_ONLY, baseType,
+ true, 1, baseType, false));
+
+ paramMap.put(functionBaseName + NAME_BASE_BAG_SIZE,
+ new BagParameters(ID_BASE_BAG_SIZE, baseType, true,
+ 1, IntegerAttribute.identifier,
+ false));
+
+ paramMap.put(functionBaseName + NAME_BASE_BAG,
+ new BagParameters(ID_BASE_BAG, baseType, false, -1,
+ baseType, true));
+ }
supportedIds = Collections.
Index: ConditionSetFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/ConditionSetFunction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConditionSetFunction.java 24 May 2004 21:39:22 -0000 1.4
--- ConditionSetFunction.java 13 Jan 2006 22:32:51 -0000 1.5
***************
*** 3,7 ****
* @(#)ConditionSetFunction.java
*
! * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)ConditionSetFunction.java
*
! * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 98,101 ****
--- 98,117 ----
}
+ for (int i = 0; i < baseTypes2.length; i++) {
+ String baseName = FUNCTION_NS_2 + simpleTypes2[i];
+ String baseType = baseTypes2[i];
+
+ idMap.put(baseName + NAME_BASE_AT_LEAST_ONE_MEMBER_OF,
+ new Integer(ID_BASE_AT_LEAST_ONE_MEMBER_OF));
+ idMap.put(baseName + NAME_BASE_SUBSET,
+ new Integer(ID_BASE_SUBSET));
+ idMap.put(baseName + NAME_BASE_SET_EQUALS,
+ new Integer(ID_BASE_SET_EQUALS));
+
+ typeMap.put(baseName + NAME_BASE_AT_LEAST_ONE_MEMBER_OF, baseType);
+ typeMap.put(baseName + NAME_BASE_SUBSET, baseType);
+ typeMap.put(baseName + NAME_BASE_SET_EQUALS, baseType);
+ }
+
supportedIds = Collections.
unmodifiableSet(new HashSet(idMap.keySet()));
Index: SetFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/SetFunction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SetFunction.java 18 Mar 2004 21:13:09 -0000 1.4
--- SetFunction.java 13 Jan 2006 22:32:51 -0000 1.5
***************
*** 3,7 ****
* @(#)SetFunction.java
*
! * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)SetFunction.java
*
! * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 47,53 ****
--- 47,55 ----
import com.sun.xacml.attr.DateTimeAttribute;
import com.sun.xacml.attr.DayTimeDurationAttribute;
+ import com.sun.xacml.attr.DNSNameAttribute;
import com.sun.xacml.attr.DoubleAttribute;
import com.sun.xacml.attr.HexBinaryAttribute;
import com.sun.xacml.attr.IntegerAttribute;
+ import com.sun.xacml.attr.IPAddressAttribute;
import com.sun.xacml.attr.RFC822NameAttribute;
import com.sun.xacml.attr.StringAttribute;
***************
*** 119,123 ****
/**
* A complete list of all the XACML datatypes supported by the Set
! * functions
*/
protected static String baseTypes [] = {
--- 121,125 ----
/**
* A complete list of all the XACML datatypes supported by the Set
! * functions in XACML 1.x
*/
protected static String baseTypes [] = {
***************
*** 139,145 ****
/**
* A complete list of all the XACML datatypes supported by the Set
! * functions, using the "simple" form of the names (eg, string
! * instead of http://www.w3.org/2001/XMLSchema#string)
*/
protected static String simpleTypes [] = {
--- 141,156 ----
/**
+ * A complete list of all the XACML datatypes newly supported by the Set
+ * functions in XACML 2.0
+ */
+ protected static String baseTypes2 [] = {
+ IPAddressAttribute.identifier,
+ DNSNameAttribute.identifier
+ };
+
+ /**
* A complete list of all the XACML datatypes supported by the Set
! * functions in XACML 1.x, using the "simple" form of the names (eg,
! * string instead of http://www.w3.org/2001/XMLSchema#string)
*/
protected static String simpleTypes [] = {
***************
*** 150,153 ****
--- 161,173 ----
/**
+ * A complete list of all the XACML datatypes newly supported by the Set
+ * functions in XACML 2.0, using the "simple" form of the names (eg,
+ * string instead of http://www.w3.org/2001/XMLSchema#string)
+ */
+ protected static String simpleTypes2 [] = {
+ "ipAddress", "dnsName"
+ };
+
+ /**
* Creates a new instance of the intersection set function.
* This should be used to create support for any new attribute types
--- NEW FILE: StringFunction.java ---
/*
* @(#)StringFunction.java
*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml.cond;
import com.sun.xacml.EvaluationCtx;
import com.sun.xacml.attr.AttributeValue;
import com.sun.xacml.attr.StringAttribute;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* This class implements the string-concatenate function from XACML 2.0.
*
* @since 2.0
* @author Seth Proctor
*/
public class StringFunction extends FunctionBase
{
/**
* Standard identifier for the string-concatenate function.
*/
public static final String NAME_STRING_CONCATENATE =
FUNCTION_NS_2 + "string-concatenate";
// private identifiers for the supported functions
private static final int ID_STRING_CONCATENATE = 0;
/**
* Creates a new <code>StringFunction</code> object.
*
* @param functionName the standard XACML name of the function to be
* handled by this object, including the full namespace
*
* @throws IllegalArgumentException if the function is unknown
*/
public StringFunction(String functionName) {
super(functionName, ID_STRING_CONCATENATE, StringAttribute.identifier,
false, -1, 2, StringAttribute.identifier, false);
}
/**
* Returns a <code>Set</code> containing all the function identifiers
* supported by this class.
*
* @return a <code>Set</code> of <code>String</code>s
*/
public static Set getSupportedIdentifiers() {
Set set = new HashSet();
set.add(NAME_STRING_CONCATENATE);
return set;
}
/**
* Evaluate the function, using the specified parameters.
*
* @param inputs a <code>List</code> of <code>Evaluatable</code>
* objects representing the arguments passed to the function
* @param context an <code>EvaluationCtx</code> so that the
* <code>Evaluatable</code> objects can be evaluated
* @return an <code>EvaluationResult</code> representing the
* function's result
*/
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {
// Evaluate the arguments
AttributeValue [] argValues = new AttributeValue[inputs.size()];
EvaluationResult result = evalArgs(inputs, context, argValues);
if (result != null)
return result;
switch (getFunctionId()) {
case ID_STRING_CONCATENATE:
String str = ((StringAttribute)argValues[0]).getValue();
for (int i = 1; i < argValues.length; i++)
str += ((StringAttribute)(argValues[i])).getValue();
result = new EvaluationResult(new StringAttribute(str));
break;
}
return result;
}
}
Index: GeneralSetFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/GeneralSetFunction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** GeneralSetFunction.java 24 May 2004 21:39:22 -0000 1.4
--- GeneralSetFunction.java 13 Jan 2006 22:32:51 -0000 1.5
***************
*** 3,7 ****
* @(#)GeneralSetFunction.java
*
! * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)GeneralSetFunction.java
*
! * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 91,94 ****
--- 91,107 ----
typeMap.put(baseName + NAME_BASE_UNION, baseType);
}
+
+ for (int i = 0; i < baseTypes2.length; i++) {
+ String baseName = FUNCTION_NS_2 + simpleTypes2[i];
+ String baseType = baseTypes2[i];
+
+ idMap.put(baseName + NAME_BASE_INTERSECTION,
+ new Integer(ID_BASE_INTERSECTION));
+ idMap.put(baseName + NAME_BASE_UNION,
+ new Integer(ID_BASE_UNION));
+
+ typeMap.put(baseName + NAME_BASE_INTERSECTION, baseType);
+ typeMap.put(baseName + NAME_BASE_UNION, baseType);
+ }
};
Index: FunctionFactory.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/FunctionFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** FunctionFactory.java 17 May 2004 20:33:45 -0000 1.7
--- FunctionFactory.java 13 Jan 2006 22:32:51 -0000 1.8
***************
*** 3,7 ****
* @(#)FunctionFactory.java
*
! * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)FunctionFactory.java
*
! * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 38,45 ****
--- 38,47 ----
import com.sun.xacml.ParsingException;
+ import com.sun.xacml.PolicyMetaData;
import com.sun.xacml.UnknownIdentifierException;
import java.net.URI;
+ import java.util.HashMap;
import java.util.Set;
***************
*** 68,77 ****
private static FunctionFactoryProxy defaultFactoryProxy;
/**
! * static intialiazer that sets up the default factory proxies
! * NOTE: this will change when the right setup mechanism is in place
*/
static {
! defaultFactoryProxy = new FunctionFactoryProxy() {
public FunctionFactory getTargetFactory() {
return StandardFunctionFactory.getTargetFactory();
--- 70,82 ----
private static FunctionFactoryProxy defaultFactoryProxy;
+ // the map of registered factories
+ private static HashMap registeredFactories;
+
/**
! * static intialiazer that sets up the default factory proxies and
! * registers the standard namespaces
*/
static {
! FunctionFactoryProxy proxy = new FunctionFactoryProxy() {
public FunctionFactory getTargetFactory() {
return StandardFunctionFactory.getTargetFactory();
***************
*** 84,87 ****
--- 89,98 ----
}
};
+
+ registeredFactories = new HashMap();
+ registeredFactories.put(PolicyMetaData.XACML_1_0_IDENTIFIER, proxy);
+ registeredFactories.put(PolicyMetaData.XACML_2_0_IDENTIFIER, proxy);
+
+ defaultFactoryProxy = proxy;
};
***************
*** 104,107 ****
--- 115,138 ----
/**
+ * Returns a factory based on the given identifier. You may register
+ * as many factories as you like, and then retrieve them through this
+ * interface, but a factory may only be registered once using a given
+ * identifier. By default, the standard XACML 1.0 and 2.0 identifiers
+ * are regsietered to provide the standard factory.
+ *
+ * @param identifier the identifier for a factory
+ *
+ * @return a <code>FunctionFactory</code> that supports Target functions
+ *
+ * @throws UnknownIdentifierException if the given identifier isn't
+ * registered
+ */
+ public static final FunctionFactory getTargetInstance(String identifier)
+ throws UnknownIdentifierException
+ {
+ return getRegisteredProxy(identifier).getTargetFactory();
+ }
+
+ /**
* Returns the default FuntionFactory that will only provide those
* functions that are usable in the root of the Condition. These Functions
***************
*** 115,118 ****
--- 146,169 ----
/**
+ * Returns a factory based on the given identifier. You may register
+ * as many factories as you like, and then retrieve them through this
+ * interface, but a factory may only be registered once using a given
+ * identifier. By default, the standard XACML 1.0 and 2.0 identifiers
+ * are regsietered to provide the standard factory.
+ *
+ * @param identifier the identifier for a factory
+ *
+ * @return a <code>FunctionFactory</code> that supports Condition functions
+ *
+ * @throws UnknownIdentifierException if the given identifier isn't
+ * registered
+ */
+ public static final FunctionFactory getConditionInstance(String identifier)
+ throws UnknownIdentifierException
+ {
+ return getRegisteredProxy(identifier).getConditionFactory();
+ }
+
+ /**
* Returns the default FunctionFactory that provides access to all the
* functions. These Functions are a superset of the Condition functions.
***************
*** 125,130 ****
/**
! * Sets the default factory. Note that this is just a placeholder for
! * now, and will be replaced with a more useful mechanism soon.
*/
public static final void setDefaultFactory(FunctionFactoryProxy proxy) {
--- 176,251 ----
/**
! * Returns a factory based on the given identifier. You may register
! * as many factories as you like, and then retrieve them through this
! * interface, but a factory may only be registered once using a given
! * identifier. By default, the standard XACML 1.0 and 2.0 identifiers
! * are regsietered to provide the standard factory.
! *
! * @param identifier the identifier for a factory
! *
! * @return a <code>FunctionFactory</code> that supports General functions
! *
! * @throws UnknownIdentifierException if the given identifier isn't
! * registered
! */
! public static final FunctionFactory getGeneralInstance(String identifier)
! throws UnknownIdentifierException
! {
! return getRegisteredProxy(identifier).getGeneralFactory();
! }
!
! /**
! * Returns the default FunctionFactoryProxy that provides access to all
! * the functions.
! *
! * @return a <code>FunctionFactoryProxy</code> for all functions
! */
! public static final FunctionFactoryProxy getInstance() {
! return defaultFactoryProxy;
! }
!
! /**
! * Returns a factory based on the given identifier. You may register
! * as many factories as you like, and then retrieve them through this
! * interface, but a factory may only be registered once using a given
! * identifier. By default, the standard XACML 1.0 and 2.0 identifiers
! * are regsietered to provide the standard factory.
! *
! * @param identifier the identifier for a factory
! *
! * @return a <code>FunctionFactoryProxy</code>
! *
! * @throws UnknownIdentifierException if the given identifier isn't
! * registered
! */
! public static final FunctionFactoryProxy getInstance(String identifier)
! throws UnknownIdentifierException
! {
! return getRegisteredProxy(identifier);
! }
!
! /**
! * Private helper that resolves the proxy for the given identifier, or
! * throws an exception if no proxy is registered for that identifier.
! */
! private static FunctionFactoryProxy getRegisteredProxy(String identifier)
! throws UnknownIdentifierException
! {
! FunctionFactoryProxy proxy =
! (FunctionFactoryProxy)(registeredFactories.get(identifier));
!
! if (proxy == null)
! throw new UnknownIdentifierException("Uknown FunctionFactory " +
! "identifier: " + identifier);
!
! return proxy;
! }
!
! /**
! * Sets the default factory. This does not register the factory proxy as
! * an identifiable factory.
! *
! * @param proxy the <code>FunctionFactoryProxy</code> to set as the new
! * default factory proxy
*/
public static final void setDefaultFactory(FunctionFactoryProxy proxy) {
***************
*** 133,136 ****
--- 254,284 ----
/**
+ * Registers the given factory proxy with the given identifier. If the
+ * identifier is already used, then this throws an exception. If the
+ * identifier is not already used, then it will always be bound to the
+ * given proxy.
+ *
+ * @param identifier the identifier for the proxy
+ * @param proxy the <code>FunctionFactoryProxy</code> to register with
+ * the given identifier
+ *
+ * @throws IllegalArgumentException if the identifier is already used
+ */
+ public static final void registerFactory(String identifier,
+ FunctionFactoryProxy proxy)
+ throws IllegalArgumentException
+ {
+ synchronized (registeredFactories) {
+ if (registeredFactories.containsKey(identifier))
+ throw new IllegalArgumentException("Identifier is already " +
+ "registered as " +
+ "FunctionFactory: " +
+ identifier);
+
+ registeredFactories.put(identifier, proxy);
+ }
+ }
+
+ /**
* Adds the function to the factory. Most functions have no state, so
* the singleton model used here is typically desireable. The factory will
--- NEW FILE: URLStringCatFunction.java ---
/*
* @(#)URLStringCatFunction.java
*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml.cond;
import com.sun.xacml.EvaluationCtx;
import com.sun.xacml.attr.AnyURIAttribute;
import com.sun.xacml.attr.AttributeValue;
import com.sun.xacml.attr.StringAttribute;
import com.sun.xacml.ctx.Status;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Represents the XACML 2.0 url-string-concatenate function.
*
* @since 2.0
* @author Seth Proctor
*/
public class URLStringCatFunction extends FunctionBase
{
/**
* Standard identifier for the url-string-concatenate function.
*/
public static final String NAME_URL_STRING_CONCATENATE =
FUNCTION_NS_2 + "url-string-concatenate";
/**
* Creates an instance of this function.
*/
public URLStringCatFunction() {
super(NAME_URL_STRING_CONCATENATE, 0, AnyURIAttribute.identifier,
false);
}
/**
* Checks the inputs of this function.
*
* @param inputs a <code>List></code> of <code>Evaluatable</code>s
*
* @throws IllegalArgumentException if the inputs won't work
*/
public void checkInputs(List inputs) throws IllegalArgumentException {
// scan the list to make sure nothing returns a bag
Iterator it = inputs.iterator();
while (it.hasNext()) {
if (((Expression)(it.next())).returnsBag())
throw new IllegalArgumentException(NAME_URL_STRING_CONCATENATE
+ " doesn't accept bags");
}
// nothing is a bag, so check using the no-bag method
checkInputsNoBag(inputs);
}
/**
* Checks the inputs of this function assuming no parameters are bags.
*
* @param inputs a <code>List></code> of <code>Evaluatable</code>s
*
* @throws IllegalArgumentException if the inputs won't work
*/
public void checkInputsNoBag(List inputs) throws IllegalArgumentException {
// make sure it's long enough
if (inputs.size() < 2)
throw new IllegalArgumentException("not enough args to " +
NAME_URL_STRING_CONCATENATE);
// check that the parameters are of the correct types...
Iterator it = inputs.iterator();
// ...the first argument must be a URI...
if (! ((Expression)(it.next())).getType().toString().
equals(AnyURIAttribute.identifier))
throw new IllegalArgumentException("illegal parameter");
// ...and all following arguments must be strings
while (it.hasNext()) {
if (! ((Expression)(it.next())).getType().toString().
equals(StringAttribute.identifier))
throw new IllegalArgumentException("illegal parameter");
}
}
/**
* Evaluates the function given the input data. This function expects
* an <code>AnyURIAttribute</code> followed by one or more
* <code>StringAttribute</code>s, and returns an
* <code>AnyURIAttribute</code>.
*
* @param inputs the input agrument list
* @param context the representation of the request
*
* @return the result of evaluation
*/
public EvaluationResult evaluate(List inputs, EvaluationCtx context) {
// Evaluate the arguments
AttributeValue [] argValues = new AttributeValue[inputs.size()];
EvaluationResult result = evalArgs(inputs, context, argValues);
if (result != null)
return result;
// the first argument is always a URI
String str = ((AnyURIAttribute)(argValues[0])).getValue().toString();
// the remaining arguments are strings
for (int i = 1; i < argValues.length; i++)
str += ((StringAttribute)(argValues[i])).getValue();
// finally, try to convert the string back to a URI
try {
return new EvaluationResult(new AnyURIAttribute(new URI(str)));
} catch (URISyntaxException use) {
List code = new ArrayList();
code.add(Status.STATUS_PROCESSING_ERROR);
String message = NAME_URL_STRING_CONCATENATE + " didn't produce"
+ " a valid URI: " + str;
return new EvaluationResult(new Status(code, message));
}
}
}
Index: BagFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/BagFunction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** BagFunction.java 13 Jun 2004 23:20:18 -0000 1.5
--- BagFunction.java 13 Jan 2006 22:32:51 -0000 1.6
***************
*** 3,7 ****
* @(#)BagFunction.java
*
! * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)BagFunction.java
*
! * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 43,49 ****
--- 43,51 ----
import com.sun.xacml.attr.DateTimeAttribute;
import com.sun.xacml.attr.DayTimeDurationAttribute;
+ import com.sun.xacml.attr.DNSNameAttribute;
import com.sun.xacml.attr.DoubleAttribute;
import com.sun.xacml.attr.HexBinaryAttribute;
import com.sun.xacml.attr.IntegerAttribute;
+ import com.sun.xacml.attr.IPAddressAttribute;
import com.sun.xacml.attr.RFC822NameAttribute;
import com.sun.xacml.attr.StringAttribute;
***************
*** 107,111 ****
/**
! * A complete list of all the XACML datatypes supported by the Bag
* functions
*/
--- 109,113 ----
/**
! * A complete list of all the XACML 1.x datatypes supported by the Bag
* functions
*/
***************
*** 128,133 ****
/**
! * A complete list of all the XACML datatypes supported by the Bag
! * functions, using the "simple" form of the names (eg, string
* instead of http://www.w3.org/2001/XMLSchema#string)
*/
--- 130,144 ----
/**
! * A complete list of all the XACML 2.0 datatypes newly supported by the
! * Bag functions
! */
! protected static String baseTypes2 [] = {
! IPAddressAttribute.identifier,
! DNSNameAttribute.identifier
! };
!
! /**
! * A complete list of all the 1.x XACML datatypes supported by the
! * Bag functions, using the "simple" form of the names (eg, string
* instead of http://www.w3.org/2001/XMLSchema#string)
*/
***************
*** 139,142 ****
--- 150,162 ----
/**
+ * A complete list of all the 2.0 XACML datatypes newly supported by the
+ * Bag functions, using the "simple" form of the names (eg, string
+ * instead of http://www.w3.org/2001/XMLSchema#string)
+ */
+ protected static String simpleTypes2 [] = {
+ "ipAddress", "dnsName"
+ };
+
+ /**
* Returns a new <code>BagFunction</code> that provides the
* type-one-and-only functionality over the given attribute type.
Index: MatchFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/MatchFunction.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MatchFunction.java 18 Mar 2004 21:13:09 -0000 1.5
--- MatchFunction.java 13 Jan 2006 22:32:51 -0000 1.6
***************
*** 3,7 ****
* @(#)MatchFunction.java
*
! * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)MatchFunction.java
*
! * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 39,44 ****
--- 39,47 ----
import com.sun.xacml.EvaluationCtx;
+ import com.sun.xacml.attr.AnyURIAttribute;
import com.sun.xacml.attr.AttributeValue;
import com.sun.xacml.attr.BooleanAttribute;
+ import com.sun.xacml.attr.DNSNameAttribute;
+ import com.sun.xacml.attr.IPAddressAttribute;
import com.sun.xacml.attr.RFC822NameAttribute;
import com.sun.xacml.attr.StringAttribute;
***************
*** 55,59 ****
/**
! * Implements the three standard matching functions.
*
* @since 1.0
--- 58,62 ----
/**
! * Implements the standard matching and regular expression functions.
*
* @since 1.0
***************
*** 81,89 ****
--- 84,137 ----
public static final String NAME_RFC822NAME_MATCH =
FUNCTION_NS + "rfc822Name-match";
+
+ /**
+ * Standard identifier for the string-regexp-match function. NOTE: this
+ * in the 1.0 namespace right now because of a bug in the XACML 2.0
+ * specification, but this will be changed to the 2.0 namespace as soon
+ * as the errata is recognized.
+ */
+ public static final String NAME_STRING_REGEXP_MATCH =
+ FUNCTION_NS + "string-regexp-match";
+ /**
+ * Standard identifier for the anyURI-regexp-match function.
+ */
+ public static final String NAME_ANYURI_REGEXP_MATCH =
+ FUNCTION_NS_2 + "anyURI-regexp-match";
+
+ /**
+ * Standard identifier for the ipAddress-regexp-match function.
+ */
+ public static final String NAME_IPADDRESS_REGEXP_MATCH =
+ FUNCTION_NS_2 + "ipAddress-regexp-match";
+
+ /**
+ * Standard identifier for the dnsName-regexp-match function.
+ */
+ public static final String NAME_DNSNAME_REGEXP_MATCH =
+ FUNCTION_NS_2 + "dnsName-regexp-match";
+
+ /**
+ * Standard identifier for the rfc822Name-regexp-match function.
+ */
+ public static final String NAME_RFC822NAME_REGEXP_MATCH =
+ FUNCTION_NS_2 + "rfc822Name-regexp-match";
+
+ /**
+ * Standard identifier for the x500Name-regexp-match function.
+ */
+ public static final String NAME_X500NAME_REGEXP_MATCH =
+ FUNCTION_NS_2 + "x500Name-regexp-match";
+
// private identifiers for the supported functions
private static final int ID_REGEXP_STRING_MATCH = 0;
private static final int ID_X500NAME_MATCH = 1;
private static final int ID_RFC822NAME_MATCH = 2;
+ private static final int ID_STRING_REGEXP_MATCH = 3;
+ private static final int ID_ANYURI_REGEXP_MATCH = 4;
+ private static final int ID_IPADDRESS_REGEXP_MATCH = 5;
+ private static final int ID_DNSNAME_REGEXP_MATCH = 6;
+ private static final int ID_RFC822NAME_REGEXP_MATCH = 7;
+ private static final int ID_X500NAME_REGEXP_MATCH = 8;
// private mappings for the input arguments
***************
*** 97,100 ****
--- 145,166 ----
StringAttribute.identifier,
RFC822NameAttribute.identifier};
+ private static final String stringRegexpParams [] = {
+ StringAttribute.identifier,
+ StringAttribute.identifier};
+ private static final String anyURIRegexpParams [] = {
+ StringAttribute.identifier,
+ AnyURIAttribute.identifier};
+ private static final String ipAddressRegexpParams [] = {
+ StringAttribute.identifier,
+ IPAddressAttribute.identifier};
+ private static final String dnsNameRegexpParams [] = {
+ StringAttribute.identifier,
+ DNSNameAttribute.identifier};
+ private static final String rfc822NameRegexpParams [] = {
+ StringAttribute.identifier,
+ RFC822NameAttribute.identifier};
+ private static final String x500NameRegexpParams [] = {
+ StringAttribute.identifier,
+ X500NameAttribute.identifier};
// private mapping for bag input options
***************
*** 126,129 ****
--- 192,207 ----
else if (functionName.equals(NAME_RFC822NAME_MATCH))
return ID_RFC822NAME_MATCH;
+ else if (functionName.equals(NAME_STRING_REGEXP_MATCH))
+ return ID_STRING_REGEXP_MATCH;
+ else if (functionName.equals(NAME_ANYURI_REGEXP_MATCH))
+ return ID_ANYURI_REGEXP_MATCH;
+ else if (functionName.equals(NAME_IPADDRESS_REGEXP_MATCH))
+ return ID_IPADDRESS_REGEXP_MATCH;
+ else if (functionName.equals(NAME_DNSNAME_REGEXP_MATCH))
+ return ID_DNSNAME_REGEXP_MATCH;
+ else if (functionName.equals(NAME_RFC822NAME_REGEXP_MATCH))
+ return ID_RFC822NAME_REGEXP_MATCH;
+ else if (functionName.equals(NAME_X500NAME_REGEXP_MATCH))
+ return ID_X500NAME_REGEXP_MATCH;
throw new IllegalArgumentException("unknown match function: " +
***************
*** 142,147 ****
else if (functionName.equals(NAME_X500NAME_MATCH))
return x500Params;
! else
return rfc822Params;
}
--- 220,239 ----
else if (functionName.equals(NAME_X500NAME_MATCH))
return x500Params;
! else if (functionName.equals(NAME_RFC822NAME_MATCH))
return rfc822Params;
+ else if (functionName.equals(NAME_STRING_REGEXP_MATCH))
+ return stringRegexpParams;
+ else if (functionName.equals(NAME_ANYURI_REGEXP_MATCH))
+ return anyURIRegexpParams;
+ else if (functionName.equals(NAME_IPADDRESS_REGEXP_MATCH))
+ return ipAddressRegexpParams;
+ else if (functionName.equals(NAME_DNSNAME_REGEXP_MATCH))
+ return dnsNameRegexpParams;
+ else if (functionName.equals(NAME_RFC822NAME_REGEXP_MATCH))
+ return rfc822NameRegexpParams;
+ else if (functionName.equals(NAME_X500NAME_REGEXP_MATCH))
+ return x500NameRegexpParams;
+
+ return null;
}
***************
*** 158,161 ****
--- 250,259 ----
set.add(NAME_X500NAME_MATCH);
set.add(NAME_RFC822NAME_MATCH);
+ set.add(NAME_STRING_REGEXP_MATCH);
+ set.add(NAME_ANYURI_REGEXP_MATCH);
+ set.add(NAME_IPADDRESS_REGEXP_MATCH);
+ set.add(NAME_DNSNAME_REGEXP_MATCH);
+ set.add(NAME_RFC822NAME_MATCH);
+ set.add(NAME_X500NAME_MATCH);
return set;
***************
*** 188,246 ****
switch (getFunctionId()) {
! case ID_REGEXP_STRING_MATCH: {
// arg0 is a regular expression; arg1 is a general string
String arg0 = ((StringAttribute)(argValues[0])).getValue();
String arg1 = ((StringAttribute)(argValues[1])).getValue();
! // the regular expression syntax required by XACML differs
! // from the syntax supported by java.util.regex.Pattern
! // in several ways; the next several code blocks transform
! // the XACML syntax into a semantically equivalent Pattern syntax
!
! StringBuffer buf = new StringBuffer(arg0);
!
! // in order to handle the requirement that the string is
! // considered to match the pattern if any substring matches
! // the pattern, we prepend ".*" and append ".*" to the reg exp,
! // but only if there isn't an anchor (^ or $) in place
!
! if (arg0.charAt(0) != '^')
! buf = buf.insert(0, ".*");
!
! if (arg0.charAt(arg0.length() - 1) != '$')
! buf = buf.insert(buf.length(), ".*");
!
! // in order to handle Unicode blocks, we replace all
! // instances of "\p{Is" with "\p{In" in the reg exp
!
! int idx = -1;
! idx = buf.indexOf("\\p{Is", 0);
! while (idx != -1){
! buf = buf.replace(idx, idx+5, "\\p{In");
! idx = buf.indexOf("\\p{Is", idx);
! }
!
! // in order to handle Unicode blocks, we replace all instances
! // of "\P{Is" with "\P{In" in the reg exp
!
! idx = -1;
! idx = buf.indexOf("\\P{Is", 0);
! while (idx != -1){
! buf = buf.replace(idx, idx+5, "\\P{In");
! idx = buf.indexOf("\\P{Is", idx);
! }
!
! // in order to handle character class subtraction, we
! // replace all instances of "-[" with "&&[^" in the reg exp
!
! idx = -1;
! idx = buf.indexOf("-[", 0);
! while (idx != -1){
! buf = buf.replace(idx, idx+2, "&&[^");
! idx = buf.indexOf("-[", idx);
! }
! arg0 = buf.toString();
!
! boolResult = Pattern.matches(arg0, arg1);
break;
--- 286,296 ----
switch (getFunctionId()) {
! case ID_REGEXP_STRING_MATCH:
! case ID_STRING_REGEXP_MATCH: {
// arg0 is a regular expression; arg1 is a general string
String arg0 = ((StringAttribute)(argValues[0])).getValue();
String arg1 = ((StringAttribute)(argValues[1])).getValue();
! boolResult = regexpHelper(arg0, arg1);
break;
***************
*** 279,282 ****
--- 329,382 ----
}
+ case ID_ANYURI_REGEXP_MATCH: {
+ // arg0 is a regular expression; arg1 is a general string
+ String arg0 = ((StringAttribute)(argValues[0])).getValue();
+ String arg1 = ((AnyURIAttribute)(argValues[1])).encode();
+
+ boolResult = regexpHelper(arg0, arg1);
+
+ break;
+ }
+
+ case ID_IPADDRESS_REGEXP_MATCH: {
+ // arg0 is a regular expression; arg1 is a general string
+ String arg0 = ((StringAttribute)(argValues[0])).getValue();
+ String arg1 = ((IPAddressAttribute)(argValues[1])).encode();
+
+ boolResult = regexpHelper(arg0, arg1);
+
+ break;
+ }
+
+ case ID_DNSNAME_REGEXP_MATCH: {
+ // arg0 is a regular expression; arg1 is a general string
+ String arg0 = ((StringAttribute)(argValues[0])).getValue();
+ String arg1 = ((DNSNameAttribute)(argValues[1])).encode();
+
+ boolResult = regexpHelper(arg0, arg1);
+
+ break;
+ }
+
+ case ID_RFC822NAME_REGEXP_MATCH: {
+ // arg0 is a regular expression; arg1 is a general string
+ String arg0 = ((StringAttribute)(argValues[0])).getValue();
+ String arg1 = ((RFC822NameAttribute)(argValues[1])).encode();
+
+ boolResult = regexpHelper(arg0, arg1);
+
+ break;
+ }
+
+ case ID_X500NAME_REGEXP_MATCH: {
+ // arg0 is a regular expression; arg1 is a general string
+ String arg0 = ((StringAttribute)(argValues[0])).getValue();
+ String arg1 = ((X500NameAttribute)(argValues[1])).encode();
+
+ boolResult = regexpHelper(arg0, arg1);
+
+ break;
+ }
+
}
***************
*** 284,286 ****
--- 384,442 ----
return EvaluationResult.getInstance(boolResult);
}
+
+ /**
+ *
+ */
+ private boolean regexpHelper(String xpr, String str) {
+ // the regular expression syntax required by XACML differs
+ // from the syntax supported by java.util.regex.Pattern
+ // in several ways; the next several code blocks transform
+ // the XACML syntax into a semantically equivalent Pattern syntax
+
+ StringBuffer buf = new StringBuffer(xpr);
+
+ // in order to handle the requirement that the string is
+ // considered to match the pattern if any substring matches
+ // the pattern, we prepend ".*" and append ".*" to the reg exp,
+ // but only if there isn't an anchor (^ or $) in place
+
+ if (xpr.charAt(0) != '^')
+ buf = buf.insert(0, ".*");
+
+ if (xpr.charAt(xpr.length() - 1) != '$')
+ buf = buf.insert(buf.length(), ".*");
+
+ // in order to handle Unicode blocks, we replace all
+ // instances of "\p{Is" with "\p{In" in the reg exp
+
+ int idx = -1;
+ idx = buf.indexOf("\\p{Is", 0);
+ while (idx != -1){
+ buf = buf.replace(idx, idx+5, "\\p{In");
+ idx = buf.indexOf("\\p{Is", idx);
+ }
+
+ // in order to handle Unicode blocks, we replace all instances
+ // of "\P{Is" with "\P{In" in the reg exp
+
+ idx = -1;
+ idx = buf.indexOf("\\P{Is", 0);
+ while (idx != -1){
+ buf = buf.replace(idx, idx+5, "\\P{In");
+ idx = buf.indexOf("\\P{Is", idx);
+ }
+
+ // in order to handle character class subtraction, we
+ // replace all instances of "-[" with "&&[^" in the reg exp
+
+ idx = -1;
+ idx = buf.indexOf("-[", 0);
+ while (idx != -1){
+ buf = buf.replace(idx, idx+2, "&&[^");
+ idx = buf.indexOf("-[", idx);
+ }
+
+ return Pattern.matches(buf.toString(), str);
+ }
+
}
Index: StandardFunctionFactory.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/StandardFunctionFactory.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** StandardFunctionFactory.java 4 Jun 2004 17:50:40 -0000 1.6
--- StandardFunctionFactory.java 13 Jan 2006 22:32:51 -0000 1.7
***************
*** 3,7 ****
* @(#)StandardFunctionFactory.java
*
! * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)StandardFunctionFactory.java
*
! * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 37,40 ****
--- 37,43 ----
package com.sun.xacml.cond;
+ import com.sun.xacml.PolicyMetaData;
+ import com.sun.xacml.UnknownIdentifierException;
+
import com.sun.xacml.cond.cluster.AbsFunctionCluster;
import com.sun.xacml.cond.cluster.AddFunctionCluster;
***************
*** 57,60 ****
--- 60,64 ----
import com.sun.xacml.cond.cluster.NumericConvertFunctionCluster;
import com.sun.xacml.cond.cluster.RoundFunctionCluster;
+ import com.sun.xacml.cond.cluster.StringFunctionCluster;
import com.sun.xacml.cond.cluster.StringNormalizeFunctionCluster;
import com.sun.xacml.cond.cluster.SubtractFunctionCluster;
***************
*** 75,79 ****
/**
* 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.
--- 79,83 ----
/**
* This factory supports the standard set of functions specified in XACML
! * 1.x and 2.0. 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.
***************
*** 109,112 ****
--- 113,120 ----
private static Map generalAbstractFunctions = null;
+ // the static sets of supported identifiers for each XACML version
+ private static Set supportedV1Functions;
+ private static Set supportedV2Functions;
+
// the set/map used by each singleton factory instance
private Set supportedFunctions = null;
***************
*** 238,242 ****
generalFunctions.addAll((new GeneralSetFunctionCluster()).
getSupportedFunctions());
!
generalAbstractFunctions = new HashMap(conditionAbstractFunctions);
--- 246,254 ----
generalFunctions.addAll((new GeneralSetFunctionCluster()).
getSupportedFunctions());
! // add the XACML 2.0 string functions
! generalFunctions.addAll((new StringFunctionCluster()).
! getSupportedFunctions());
!
!
generalAbstractFunctions = new HashMap(conditionAbstractFunctions);
***************
*** 328,337 ****
/**
! * 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);
}
--- 340,358 ----
/**
! * Returns the identifiers supported for the given version of XACML.
! * Because this factory supports identifiers from all versions of the
! * XACML specifications, this method is useful for getting a list of
! * which specific identifiers are supported by a given version of XACML.
*
! * @param xacmlVersion a standard XACML identifier string, as provided
! * in <code>PolicyMetaData</code>
! *
! * @return a <code>Set</code> of identifiers
! *
! * @throws UnknownIdentifierException if the version string is unknown
*/
! public static Set getStandardFunctions(String xacmlVersion) {
! // FIXME: collecting the identifiers needs to be implemented..
! throw new RuntimeException("This method isn't implemented yet.");
}
***************
*** 343,348 ****
* <code>FunctionProxy</code>s
*/
! public Map getStandardAbstractFunctions() {
! return Collections.unmodifiableMap(supportedAbstractFunctions);
}
--- 364,370 ----
* <code>FunctionProxy</code>s
*/
! public static Map getStandardAbstractFunctions(String xacmlVersion) {
! // FIXME: collecting the identifiers needs to be implemented..
! throw new RuntimeException("This method isn't implemented yet.");
}
***************
*** 357,379 ****
*/
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,
--- 379,397 ----
*/
public static FunctionFactoryProxy getNewFactoryProxy() {
! // first off, make sure everything's been initialized
! getGeneralFactory();
!
! // now create the new instances
FunctionFactory newGeneral =
! new BaseFunctionFactory(generalFunctions,
! generalAbstractFunctions);
FunctionFactory newCondition =
! new BaseFunctionFactory(newGeneral, conditionFunctions,
! conditionAbstractFunctions);
FunctionFactory newTarget =
! new BaseFunctionFactory(newCondition, targetFunctions,
! targetAbstractFunctions);
return new BasicFunctionFactoryProxy(newTarget, newCondition,
Index: ConditionBagFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/ConditionBagFunction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConditionBagFunction.java 24 May 2004 21:39:22 -0000 1.4
--- ConditionBagFunction.java 13 Jan 2006 22:32:51 -0000 1.5
***************
*** 3,7 ****
* @(#)ConditionBagFunction.java
*
! * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)ConditionBagFunction.java
*
! * Copyright 2004-206 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 75,78 ****
--- 75,85 ----
argMap.put(FUNCTION_NS + simpleTypes[i] + NAME_BASE_IS_IN, args);
}
+
+ for (int i = 0; i < baseTypes2.length; i++) {
+ String [] args = { baseTypes2[i], baseTypes2[i] };
+
+ argMap.put(FUNCTION_NS_2 + simpleTypes2[i] + NAME_BASE_IS_IN,
+ args);
+ }
}
Index: EqualFunction.java
===================================================================
RCS file: /cvsroot/sunxacml/sunxacml/com/sun/xacml/cond/EqualFunction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** EqualFunction.java 24 May 2004 21:39:22 -0000 1.6
--- EqualFunction.java 13 Jan 2006 22:32:51 -0000 1.7
***************
*** 3,7 ****
* @(#)EqualFunction.java
*
! * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
--- 3,7 ----
* @(#)EqualFunction.java
*
! * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
***************
*** 46,52 ****
--- 46,54 ----
import com.sun.xacml.attr.DateTimeAttribute;
import com.sun.xacml.attr.DayTimeDurationAttribute;
+ import com.sun.xacml.attr.DNSNameAttribute;
import com.sun.xacml.attr.DoubleAttribute;
import com.sun.xacml.attr.HexBinaryAttribute;
import com.sun.xacml.attr.IntegerAttribute;
+ import com.sun.xacml.attr.IPAddressAttribute;
import com.sun.xacml.attr.RFC822NameAttribute;
import com.sun.xacml.attr.StringAttribute;
***************
*** 159,162 ****
--- 161,176 ----
FUNCTION_NS + "base64Binary-equal";
+ /**
+ * Standard identifier for the ipAddress-equal function.
+ */
+ public static final String NAME_IPADDRESS_EQUAL =
+ FUNCTION_NS_2 + "ipAddress-equal";
+
+ /**
+ * Standard identifier for the dnsName-equal function.
+ */
+ public static final String NAME_DNSNAME_EQUAL =
+ FUNCTION_NS_2 + "dnsName-equal";
+
// private mapping of standard functions to their argument types
private static HashMap typeMap;
***************
*** 185,188 ****
--- 199,204 ----
typeMap.put(NAME_HEXBINARY_EQUAL, HexBinaryAttribute.identifier);
typeMap.put(NAME_BASE64BINARY_EQUAL, Base64BinaryAttribute.identifier);
+ typeMap.put(NAME_IPADDRESS_EQUAL, IPAddressAttribute.identifier);
+ typeMap.put(NAME_DNSNAME_EQUAL, DNSNameAttribute.identifier);
}
|