All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.att.research.xacmlatt.pdp.policy.CombiningAlgorithmFactory Maven / Gradle / Ivy

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;

/**
 * CombiningAlgorithmFactory is an abstract class for mapping function {@link com.att.research.xacml.api.Identifier} ids to
 * {@link com.att.research.xacmlatt.pdp.policy.CombiningAlgorithm} objects.
 * 
 * @author car
 * @version $Revision: 1.3 $
 */
public abstract class CombiningAlgorithmFactory {
	private static final String	FACTORYID					= ATTPDPProperties.PROP_COMBININGALGORITHMFACTORY;
	private static final String DEFAULT_FACTORY_CLASSNAME	= "com.att.research.xacmlatt.pdp.std.StdCombiningAlgorithmFactory";
	
	protected CombiningAlgorithmFactory() {
	}
	
	protected CombiningAlgorithmFactory(Properties properties) {
	}
	
	/**
	 * Maps the given Identifier representing a XACML rule combining algorithm to a CombiningAlgorithm object.
	 * 
	 * @param combiningAlgorithmId the Identifier of the CombiningAlgorithm to retrieve
	 * @return the CombiningAlgorithm for the given Identifier or null if not found
	 */
	public abstract CombiningAlgorithm getRuleCombiningAlgorithm(Identifier combiningAlgorithmId);
	
	/**
	 * Maps the given Identifier representing a XACML policy combinign algorithm to a CombiningAlgorithm object.
	 * 
	 * @param combiningAlgorithmId the Identifier of the CombiningAlgorithm to retrieve
	 * @return the CombiningAlgorithm for the given Identifier or null if not found
	 */
	public abstract CombiningAlgorithm getPolicyCombiningAlgorithm(Identifier combiningAlgorithmId);
	
	/**
	 * Creates an instance of the CombiningAlgorithmFactory using default configuration information.
	 * 
	 * @return the default CombiningAlgorithmFactory
	 * @throws FactoryException Exception in the factory
	 */
	public static CombiningAlgorithmFactory newInstance() throws FactoryException {
		return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, CombiningAlgorithmFactory.class);
	}
	
	/**
	 * Creates an instance of the CombiningAlgorithmFactory using default configuration information.
	 * @param properties Properties object
	 * 
	 * @return the default CombiningAlgorithmFactory
     * @throws FactoryException Exception in the factory
	 */
	public static CombiningAlgorithmFactory newInstance(Properties properties) throws FactoryException {
		return FactoryFinder.find(FACTORYID, DEFAULT_FACTORY_CLASSNAME, CombiningAlgorithmFactory.class, properties);
	}
	
	/**
	 * Creates an instance of the CombiningAlgorithmFactory using the given class name.
	 * 
	 * @param className the String class name of the CombiningAlgorithmFactory to create
	 * @return the CombiningAlgorithmFactory for the given class name.
     * @throws FactoryException Exception in the factory
	 */
	public static CombiningAlgorithmFactory newInstance(String className) throws FactoryException {
		return FactoryFinder.newInstance(className, CombiningAlgorithmFactory.class, null, true);
	}
	
	/**
	 * Creates an instance of the CombiningAlgorithmFactory using the given class name using the given ClassLoader.
	 * 
	 * @param className the String class name of the CombiningAlgorithmFactory to create
	 * @param classLoader the ClassLoader to use to load the class with the given class name
	 * @return the CombiningAlgorithmFactory for the given class name
     * @throws FactoryException Exception in the factory
	 */
	public static CombiningAlgorithmFactory newInstance(String className, ClassLoader classLoader) throws FactoryException {
		return FactoryFinder.newInstance(className, CombiningAlgorithmFactory.class, classLoader, false);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy