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

com.att.research.xacml.std.pip.engines.jdbc.JDBCResolver Maven / Gradle / Ivy

The newest version!
/*
 *
 *          Copyright (c) 2013,2019  AT&T Knowledge Ventures
 *                     SPDX-License-Identifier: MIT
 */
package com.att.research.xacml.std.pip.engines.jdbc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import com.att.research.xacml.api.Attribute;
import com.att.research.xacml.api.pip.PIPEngine;
import com.att.research.xacml.api.pip.PIPException;
import com.att.research.xacml.api.pip.PIPFinder;
import com.att.research.xacml.api.pip.PIPRequest;
import com.att.research.xacml.std.pip.engines.ConfigurableResolver;

/**
 * JDBCResolver is the interface used by the {@link com.att.research.xacml.std.pip.engines.jdbc.JDBCEngine} to
 * create PreparedStatements for XACML attribute requests and convert the ResultSet
 * into XACML attributes.
 * 
 * @author car
 * @version $Revision$
 */
public interface JDBCResolver extends ConfigurableResolver {

	/**
	 * Creates a {@link java.sql.PreparedStatement} for a SQL SELECT statement that will retrieve the data
	 * used to generate the XACML AttributeValues.
	 * 
	 * @param pipEngine the {@link com.att.research.xacml.api.pip.PIPEngine} making the request for XACML AttributeValues
	 * @param pipRequest the {@link com.att.research.xacml.api.pip.PIPRequest} with the requested XACML Attributes
	 * @param pipFinder the {@link com.att.research.xacml.api.pip.PIPFinder} for finding any other XACML AttributeValues required to build the query.
	 * @param connection the {@link java.sql.Connection} needed to create the PreparedStatement
	 * @return a PreparedStatement to query the database for the required XACML AttributeValues.
	 * @throws PIPException if there is an error creating the PreparedStatement
	 */
	public PreparedStatement getPreparedStatement(PIPEngine pipEngine, PIPRequest pipRequest, PIPFinder pipFinder, Connection connection) throws PIPException;
	
	/**
	 * Creates a List of {@link com.att.research.xacml.api.Attribute}s from the given {@link java.sql.ResultSet}
	 * returned by a SQL SELECT statement.  The ResultSet should already be positioned at the first element to decode.
	 * The implementation may choose to decode multiple results before returning or may only decode the current result.  The implementation
	 * should leave the cursor on the last result decoded.
	 * 
	 * @param resultSet the ResultSet returned from a SQL SELECT statement.
	 * @return a new List of Attributes generated by parsing the given ResultSet or an empty
	 * List if there are no results.
	 * @throws PIPException
	 */
	public List decodeResult(ResultSet resultSet) throws PIPException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy