Commit aaf13b99 authored by cdanger's avatar cdanger

Fixed javadoc comments

parent 28fd3dd0
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
* WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS
* SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import org.ow2.authzforce.core.pdp.api.Datatype;
import org.ow2.authzforce.core.pdp.api.Expression;
import org.ow2.authzforce.core.pdp.api.FirstOrderFunction;
import org.ow2.authzforce.core.pdp.api.FirstOrderFunctionCall;
import org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException;
import org.ow2.authzforce.core.pdp.impl.value.BooleanValue;
import org.ow2.authzforce.core.pdp.impl.value.DatatypeConstants;
/**
* A class that implements the not function. This function takes one boolean argument and returns the logical negation of that value. If the argument evaluates
* to indeterminate, an indeterminate result is returned.
*
* @since 1.0
* @author Steve Hanna
* @author Seth Proctor
*/
public final class NotFunction extends FirstOrderFunction.SingleParameterTyped<BooleanValue, BooleanValue>
{
/**
* Standard identifier for the not function.
*/
public static final String NAME_NOT = XACML_NS_1_0 + "not";
/**
* Singleton instance of "not" logical function
*/
public static final NotFunction INSTANCE = new NotFunction();
private NotFunction()
{
super(NAME_NOT, DatatypeConstants.BOOLEAN.TYPE, false, Collections.singletonList(DatatypeConstants.BOOLEAN.TYPE));
}
@Override
public FirstOrderFunctionCall<BooleanValue> newCall(List<Expression<?>> argExpressions, Datatype<?>... remainingArgTypes) throws IllegalArgumentException
{
return new FirstOrderFunctionCall.EagerSinglePrimitiveTypeEval<BooleanValue, BooleanValue>(functionSignature, argExpressions, remainingArgTypes)
{
@Override
protected BooleanValue evaluate(Deque<BooleanValue> args) throws IndeterminateEvaluationException
{
return args.getFirst().not();
}
};
}
}
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
* WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS
* SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
* SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import java.util.Collections;
import java.util.Deque;
import java.util.List;
import org.ow2.authzforce.core.pdp.api.Datatype;
import org.ow2.authzforce.core.pdp.api.Expression;
import org.ow2.authzforce.core.pdp.api.FirstOrderFunction;
import org.ow2.authzforce.core.pdp.api.FirstOrderFunctionCall;
import org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException;
import org.ow2.authzforce.core.pdp.impl.value.BooleanValue;
import org.ow2.authzforce.core.pdp.impl.value.DatatypeConstants;
/**
* A class that implements the not function. This function takes one boolean argument and returns the logical negation of that value. If the argument evaluates
* to indeterminate, an indeterminate result is returned.
*
* @since 1.0
* @author Steve Hanna
* @author Seth Proctor
* @version $Id: $
*/
public final class NotFunction extends FirstOrderFunction.SingleParameterTyped<BooleanValue, BooleanValue>
{
/**
* Standard identifier for the not function.
*/
public static final String NAME_NOT = XACML_NS_1_0 + "not";
/**
* Singleton instance of "not" logical function
*/
public static final NotFunction INSTANCE = new NotFunction();
private NotFunction()
{
super(NAME_NOT, DatatypeConstants.BOOLEAN.TYPE, false, Collections.singletonList(DatatypeConstants.BOOLEAN.TYPE));
}
/** {@inheritDoc} */
@Override
public FirstOrderFunctionCall<BooleanValue> newCall(List<Expression<?>> argExpressions, Datatype<?>... remainingArgTypes) throws IllegalArgumentException
{
return new FirstOrderFunctionCall.EagerSinglePrimitiveTypeEval<BooleanValue, BooleanValue>(functionSignature, argExpressions, remainingArgTypes)
{
@Override
protected BooleanValue evaluate(Deque<BooleanValue> args) throws IndeterminateEvaluationException
{
return args.getFirst().not();
}
};
}
}
This diff is collapsed.
/**
*
* Copyright 2003-2004 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;
/**
* Exception that gets thrown if an unknown identifier was used, such as the identifier used in any of the standard factories.
*
* @since 1.0
* @author Seth Proctor
*/
public class UnknownIdentifierException extends Exception
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Creates an <code>UnknownIdentifierException</code> with no data
*/
public UnknownIdentifierException()
{
}
/**
* Creates an <code>UnknownIdentifierException</code> with a message
*
* @param message
* the message
*/
public UnknownIdentifierException(String message)
{
super(message);
}
}
/**
*
* Copyright 2003-2004 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;
/**
* Exception that gets thrown if an unknown identifier was used, such as the identifier used in any of the standard factories.
*
* @since 1.0
* @author Seth Proctor
* @version $Id: $
*/
public class UnknownIdentifierException extends Exception
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Creates an <code>UnknownIdentifierException</code> with no data
*/
public UnknownIdentifierException()
{
}
/**
* Creates an <code>UnknownIdentifierException</code> with a message
*
* @param message
* the message
*/
public UnknownIdentifierException(String message)
{
super(message);
}
}
......@@ -28,7 +28,9 @@ import org.slf4j.LoggerFactory;
/**
* XACML AllOf evaluator
*
*
* @author cdangerv
* @version $Id: $
*/
public class AllOfEvaluator
{
......@@ -42,14 +44,14 @@ public class AllOfEvaluator
/**
* Instantiates AllOf (evaluator) from XACML-Schema-derived <code>AllOf</code>.
*
*
* @param jaxbAllOf
* XACML-schema-derived JAXB AllOf
* @param xPathCompiler
* XPath compiler corresponding to enclosing policy(set) default XPath version
* @param expFactory
* Expression factory
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* one of the child Match elements is invalid
*/
public AllOfEvaluator(AllOf jaxbAllOf, XPathCompiler xPathCompiler, ExpressionFactory expFactory) throws IllegalArgumentException
......@@ -80,18 +82,17 @@ public class AllOfEvaluator
/**
* Determines whether this <code>AllOf</code> matches the input request (whether it is applicable).Here is the table shown in the specification: <code>
* <Match> values <AllOf> value
* All True “Match�?
* No False and at least
* <Match> values <AllOf> value
* All True “Match�?
* No False and at least
* one "Indeterminate" “Indeterminate�?
* At least one False "No Match"
* </code>
*
*
* @param context
* the representation of the request
*
* @return true iff Match, else No match
* @throws IndeterminateEvaluationException
* @throws org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException
* Indeterminate
*/
public boolean match(EvaluationContext context) throws IndeterminateEvaluationException
......@@ -147,4 +148,4 @@ public class AllOfEvaluator
throw new IndeterminateEvaluationException("Error evaluating <AllOf>'s <Match>#" + lastIndeterminateChildIndex, lastIndeterminate.getStatusCode(),
lastIndeterminate);
}
}
\ No newline at end of file
}
......@@ -31,7 +31,9 @@ import org.slf4j.LoggerFactory;
/**
* AnyOf evaluator
*
*
* @author cdangerv
* @version $Id: $
*/
public class AnyOfEvaluator
{
......@@ -45,15 +47,14 @@ public class AnyOfEvaluator
/**
* Constructor that creates a new <code>AnyOf</code> evaluator based on the given XACML-schema-derived JAXB AnyOf.
*
*
* @param jaxbAnyOf
* JAXB AnyOf
* @param xPathCompiler
* XPath compiler corresponding to enclosing policy(set) default XPath version
* @param expFactory
* Expression factory
*
* @throws IllegalArgumentException
* @throws java.lang.IllegalArgumentException
* if one of the child AllOf elements is invalid
*/
public AnyOfEvaluator(AnyOf jaxbAnyOf, XPathCompiler xPathCompiler, ExpressionFactory expFactory) throws IllegalArgumentException
......@@ -85,20 +86,19 @@ public class AnyOfEvaluator
/**
* Determines whether this <code>AnyOf</code> matches the input request (whether it is applicable). If all the AllOf values is No_Match so it's a No_Match.
* If all matches it's a Match. If None matches and at least one “Indeterminate�? it's Indeterminate
*
*
* <pre>
* AllOf values AnyOf value
* At Least one "Match" “Match�?
* None matches and
* AllOf values AnyOf value
* At Least one "Match" “Match�?
* None matches and
* at least one Indeterminate “Indeterminate�?
* All "No Match" "No Match"
* </pre>
*
*
* @param context
* the representation of the request
*
* @return true if and only if Match (else No-match)
* @throws IndeterminateEvaluationException
* @throws org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException
* if Indeterminate
*/
public boolean match(EvaluationContext context) throws IndeterminateEvaluationException
......
/**
* Copyright (C) 2011-2015 Thales Services SAS.
*
* This file is part of AuthZForce.
*
* AuthZForce is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* AuthZForce is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with AuthZForce. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ow2.authzforce.core.pdp.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.ow2.authzforce.core.pdp.api.PdpExtension;
import org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a com.thalesgroup.authzforce.core.test.basic implementation of <code>PdpExtensionRegistry</code>.
*
* @param <T>
* type of extension in this registry
*/
public class BasePdpExtensionRegistry<T extends PdpExtension> implements PdpExtensionRegistry<T>
{
private static final Logger LOGGER = LoggerFactory.getLogger(BasePdpExtensionRegistry.class);
private static final IllegalArgumentException NULL_EXTENSION_CLASS_EXCEPTION = new IllegalArgumentException("Extension class arg undefined");
private static final IllegalArgumentException NULL_EXTENSIONS_EXCEPTION = new IllegalArgumentException("ExtensionsById arg undefined");
private final Class<? super T> extClass;
// the backing maps for the Function objects
private final Map<String, T> extensionsById;
/**
* Instantiates registry from a map (id -> extension)
*
* @param extensionClass
* extension class
*
* @param extensionsById
* extensions indexed by ID
*/
private BasePdpExtensionRegistry(Class<? super T> extensionClass, Map<String, T> extensionsById)
{
if (extensionClass == null)
{
throw NULL_EXTENSION_CLASS_EXCEPTION;
}
if (extensionsById == null)
{
throw NULL_EXTENSIONS_EXCEPTION;
}
this.extClass = extensionClass;
this.extensionsById = extensionsById;
}
/**
* Instantiates immutable registry from a set of extensions
*
* @param extensionClass
* extension class
*
* @param extensions
* extensions
*/
public BasePdpExtensionRegistry(Class<? super T> extensionClass, Set<T> extensions)
{
if (extensionClass == null)
{
throw NULL_EXTENSION_CLASS_EXCEPTION;
}
if (extensions == null)
{
throw NULL_EXTENSIONS_EXCEPTION;
}
this.extClass = extensionClass;
this.extensionsById = new HashMap<>();
for (final T extension : extensions)
{
final String id = extension.getId();
this.extensionsById.put(id, extension);
}
}
/**
* Default constructor. No superset factory is used.
*
* @param extensionClass
* extension class
*/
public BasePdpExtensionRegistry(Class<? super T> extensionClass)
{
this(extensionClass, new HashMap<String, T>());
}
/**
* Constructor that sets a "base registry" from which this inherits all the extensions. Used for instance to build a new registry based on a standard one
* like the StandardFunctionRegistry for standard functions).
*
* @param baseRegistry
* the base/parent registry on which this one is based or null
* @param extensionClass
* extension class
*/
public BasePdpExtensionRegistry(Class<? super T> extensionClass, BasePdpExtensionRegistry<T> baseRegistry)
{
this(extensionClass, baseRegistry == null ? new HashMap<String, T>() : new HashMap<>(baseRegistry.extensionsById));
}
@Override
public void addExtension(T extension) throws IllegalArgumentException
{
final String id = extension.getId();
// make sure nothing already registered with same ID
if (extensionsById.containsKey(id))
{
throw new IllegalArgumentException("Conflict: extension (id=" + id + ") already registered");
}
extensionsById.put(id, extension);
LOGGER.debug("Added PDP extension of {} to registry: {}", extClass, extension);
}
@Override
public T getExtension(String identity)
{
return extensionsById.get(identity);
}
}
/**
* Copyright (C) 2011-2015 Thales Services SAS.
*
* This file is part of AuthZForce.
*
* AuthZForce is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* AuthZForce is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with AuthZForce. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ow2.authzforce.core.pdp.impl;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.ow2.authzforce.core.pdp.api.PdpExtension;
import org.ow2.authzforce.core.pdp.api.PdpExtensionRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a com.thalesgroup.authzforce.core.test.basic implementation of <code>PdpExtensionRegistry</code>.
*
* @param <T>
* type of extension in this registry
* @author cdangerv
* @version $Id: $
*/
public class BasePdpExtensionRegistry<T extends PdpExtension> implements PdpExtensionRegistry<T>
{
private static final Logger LOGGER = LoggerFactory.getLogger(BasePdpExtensionRegistry.class);
private static final IllegalArgumentException NULL_EXTENSION_CLASS_EXCEPTION = new IllegalArgumentException("Extension class arg undefined");
private static final IllegalArgumentException NULL_EXTENSIONS_EXCEPTION = new IllegalArgumentException("ExtensionsById arg undefined");
private final Class<? super T> extClass;
// the backing maps for the Function objects
private final Map<String, T> extensionsById;
/**
* Instantiates registry from a map (id -> extension)
*
* @param extensionClass
* extension class
*
* @param extensionsById
* extensions indexed by ID
*/
private BasePdpExtensionRegistry(Class<? super T> extensionClass, Map<String, T> extensionsById)
{
if (extensionClass == null)
{
throw NULL_EXTENSION_CLASS_EXCEPTION;
}
if (extensionsById == null)
{
throw NULL_EXTENSIONS_EXCEPTION;
}
this.extClass = extensionClass;
this.extensionsById = extensionsById;
}
/**
* Instantiates immutable registry from a set of extensions
*
* @param extensionClass
* extension class
* @param extensions
* extensions
*/
public BasePdpExtensionRegistry(Class<? super T> extensionClass, Set<T> extensions)
{
if (extensionClass == null)
{
throw NULL_EXTENSION_CLASS_EXCEPTION;
}
if (extensions == null)
{
throw NULL_EXTENSIONS_EXCEPTION;
}
this.extClass = extensionClass;
this.extensionsById = new HashMap<>();
for (final T extension : extensions)
{
final String id = extension.getId();
this.extensionsById.put(id, extension);
}
}
/**
* Default constructor. No superset factory is used.
*
* @param extensionClass
* extension class
*/
public BasePdpExtensionRegistry(Class<? super T> extensionClass)
{
this(extensionClass, new HashMap<String, T>());
}
/**
* Constructor that sets a "base registry" from which this inherits all the extensions. Used for instance to build a new registry based on a standard one
* like the StandardFunctionRegistry for standard functions).
*
* @param baseRegistry
* the base/parent registry on which this one is based or null
* @param extensionClass