com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xacml-pdp Show documentation
Show all versions of xacml-pdp Show documentation
ATT reference implementation of XACML PDP engine
The newest version!
/*
*
* Copyright (c) 2013,2019 AT&T Knowledge Ventures
* SPDX-License-Identifier: MIT
*/
package com.att.research.xacmlatt.pdp.policy;
import java.util.Properties;
import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.util.FactoryException;
import com.att.research.xacml.util.FactoryFinder;
import com.att.research.xacmlatt.pdp.util.ATTPDPProperties;
/**
* FunctionDefinitionFactory is an abstract class for mapping function {@link com.att.research.xacml.api.Identifier} ids to
* {@link com.att.research.xacmlatt.pdp.policy.FunctionDefinition} objects.
*
* @author car
* @version $Revision: 1.3 $
*/
public abstract class FunctionDefinitionFactory {
private static final String FACTORYID = ATTPDPProperties.PROP_FUNCTIONDEFINITIONFACTORY;
private static final String DEFAULT_FACTORY_CLASSNAME = "com.att.research.xacmlatt.pdp.std.StdFunctionDefinitionFactory";
protected FunctionDefinitionFactory() {
}
protected FunctionDefinitionFactory(Properties properties) {
}
/**
* Maps the given Identifier
representing a XACML function to a FunctionDefinition
object.
*
* @param functionId the Identifier
of the FunctionDefinition
to retrieve
* @return the FunctionDefinition
for the given Identifier
or null if not found
*/
public abstract FunctionDefinition getFunctionDefinition(Identifier functionId);
/**
* Creates an instance of the FunctionDefinitionFactory
using default configuration information.
*
* @return the default FunctionDefinitionFactory
* @throws FactoryException Factory exception
*/
public static FunctionDefinitionFactory newInstance() throws FactoryException {
return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, FunctionDefinitionFactory.class);
}
/**
* Creates an instance of the FunctionDefinitionFactory
using default configuration information.
*
* @param properties Properties
* @return the default FunctionDefinitionFactory
* @throws FactoryException Factory exception
*/
public static FunctionDefinitionFactory newInstance(Properties properties) throws FactoryException {
return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, FunctionDefinitionFactory.class, properties);
}
/**
* Creates an instance of the FunctionDefinitionFactory
using the given class name.
*
* @param className the String
class name of the FunctionDefinitionFactory
to create
* @return the FunctionDefinitionFactory
for the given class name.
* @throws FactoryException Factory exception
*/
public static FunctionDefinitionFactory newInstance(String className) throws FactoryException {
return FactoryFinder.newInstance(className, FunctionDefinitionFactory.class, null, true);
}
/**
* Creates an instance of the FunctionDefinitionFactory
using the given class name using the given ClassLoader
.
*
* @param className the String
class name of the FunctionDefinitionFactory
to create
* @param classLoader the ClassLoader
to use to load the class with the given class name
* @return the FunctionDefinitionFactory
for the given class name
* @throws FactoryException Factory exception
*/
public static FunctionDefinitionFactory newInstance(String className, ClassLoader classLoader) throws FactoryException {
return FactoryFinder.newInstance(className, FunctionDefinitionFactory.class, classLoader, false);
}
}