[java-identity-provider COMMIT] in /trunk: idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/res...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Sep 3 12:19:05 EDT 2013
Author: rdw
Date: Tue Sep 3 12:19:05 2013
New Revision: 4745
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4745&view=rev
Log:
IDP-205 Add templating into the RDBMS data connector.
IDP-274 Extend the full test to exploit this
Added:
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/AbstractExecutableStatementBuilder.java (with props)
trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/rdbms/package-info.java (with props)
trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/velocity.xml (with props)
Modified:
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/FormatExecutableStatementBuilder.java
trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/TemplatedExecutableStatementBuilder.java
trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/ResolverPluginDependencyParser.java
trunk/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/rdbms/RdbmsDataConnectorParser.java
trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/AttributeResolverServiceTest.java
trunk/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/rdbms/RdbmsDataConnectorParserTest.java
trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/attribute-resolver.xml
trunk/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/service.xml
Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/FormatExecutableStatementBuilder.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/FormatExecutableStatementBuilder.java?rev=4745&r1=4744&r2=4745&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/FormatExecutableStatementBuilder.java (original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/dc/rdbms/FormatExecutableStatementBuilder.java Tue Sep 3 12:19:05 2013
@@ -17,30 +17,20 @@
package net.shibboleth.idp.attribute.resolver.impl.dc.rdbms;
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
import javax.annotation.Nonnull;
import net.shibboleth.idp.attribute.resolver.AttributeRecipientContext;
import net.shibboleth.idp.attribute.resolver.AttributeResolutionContext;
-import net.shibboleth.idp.attribute.resolver.ResolutionException;
-import net.shibboleth.idp.attribute.resolver.impl.dc.ExecutableSearchBuilder;
import net.shibboleth.utilities.java.support.logic.Constraint;
/**
* An {@link ExecutableStatementBuilder} that generates the SQL statement to be executed by invoking
* {@link String#format(String, Object...) with {@link AttributeRecipientContext#getPrincipal()}.
*/
-public class FormatExecutableStatementBuilder implements ExecutableSearchBuilder<ExecutableStatement> {
+public class FormatExecutableStatementBuilder extends AbstractExecutableStatementBuilder {
/** SQL query string. */
private final String sqlQuery;
-
- /** Query timeout. */
- private int queryTimeout;
/**
* Constructor.
@@ -59,50 +49,14 @@
*/
public FormatExecutableStatementBuilder(@Nonnull final String query, @Nonnull final int timeout) {
sqlQuery = Constraint.isNotNull(query, "SQL query can not be null");
- queryTimeout = (int) Constraint.isGreaterThanOrEqual(0, timeout, "Query timeout must be greater than zero");
- }
-
- /**
- * Gets the timeout of the SQL query.
- *
- * @return timeout of the SQL query in seconds
- */
- public int getQueryTimeout() {
- return queryTimeout;
- }
-
- /**
- * Sets the timeout of the SQL query.
- *
- * @param timeout of the SQL query in seconds
- */
- public void setQueryTimeout(final int timeout) {
- queryTimeout = timeout;
+ setQueryTimeout((int) Constraint.isGreaterThanOrEqual(0, timeout, "Query timeout must be greater than zero"));
}
/** {@inheritDoc} */
- public ExecutableStatement build(AttributeResolutionContext resolutionContext) throws ResolutionException {
+ protected String getSQLQuery(AttributeResolutionContext resolutionContext) {
final AttributeRecipientContext subContext = resolutionContext.getSubcontext(AttributeRecipientContext.class);
final String query = String.format(sqlQuery, subContext);
+ return query;
+ }
- return new ExecutableStatement() {
-
- /** {@inheritDoc} */
[... 418 lines stripped ...]
More information about the commits
mailing list