alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Spring Framework example source code file (CallMetaDataProvider.java)

This example Spring Framework source code file (CallMetaDataProvider.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Spring Framework tags/keywords

callmetadataprovider, callparametermetadata, callparametermetadata, databasemetadata, jdbc, list, sql, sqlexception, sqlexception, sqlparameter, sqlparameter, string, string, util

The Spring Framework CallMetaDataProvider.java source code

/*
 * Copyright 2002-2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.jdbc.core.metadata;

import java.sql.DatabaseMetaData;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.SqlParameter;

/**
 * Interface specifying the API to be implemented by a class providing call metadata.
 * This is intended for internal use by Spring's
 * {@link org.springframework.jdbc.core.simple.SimpleJdbcTemplate}.
 *
 * @author Thomas Risberg
 * @since 2.5
 */
public interface CallMetaDataProvider {

	/**
	 * Initialize using the provided DatabaseMetData.
	 * @param databaseMetaData used to retrieve database specific information
	 * @throws SQLException in case of initialization failure
	 */
	void initializeWithMetaData(DatabaseMetaData databaseMetaData) throws SQLException;

	/**
	 * Initialize the database specific management of procedure column meta data.
	 * This is only called for databases that are supported. This initalization
	 * can be turned off by specifying that column meta data should not be used.
	 * @param databaseMetaData used to retreive database specific information
	 * @param catalogName name of catalog to use or null
	 * @param schemaName name of schema name to use or null
	 * @param procedureName name of the stored procedure
	 * @throws SQLException in case of initialization failure
	 * @see	org.springframework.jdbc.core.simple.SimpleJdbcCall#withoutProcedureColumnMetaDataAccess()
	 */
	void initializeWithProcedureColumnMetaData(
			DatabaseMetaData databaseMetaData, String catalogName, String schemaName, String procedureName)
			throws SQLException;

	/**
	 * Provide any modification of the procedure name passed in to match the meta data currently used.
	 * This could include alterig the case.
	 */
	String procedureNameToUse(String procedureName);

	/**
	 * Provide any modification of the catalog name passed in to match the meta data currently used.
	 * This could include alterig the case.
	 */
	String catalogNameToUse(String catalogName);

	/**
	 * Provide any modification of the schema name passed in to match the meta data currently used.
	 * This could include alterig the case.
	 */
	String schemaNameToUse(String schemaName);

	/**
	 * Provide any modification of the catalog name passed in to match the meta data currently used.
	 * The reyurned value will be used for meta data lookups.  This could include alterig the case used or
	 * providing a base catalog if mone provided.
	 */
	String metaDataCatalogNameToUse(String catalogName) ;

	/**
	 * Provide any modification of the schema name passed in to match the meta data currently used.
	 * The reyurned value will be used for meta data lookups.  This could include alterig the case used or
	 * providing a base schema if mone provided.
	 */
	String metaDataSchemaNameToUse(String schemaName) ;

	/**
	 * Provide any modification of the column name passed in to match the meta data currently used.
	 * This could include alterig the case.
	 * @param parameterName name of the parameter of column
	 */
	String parameterNameToUse(String parameterName);

	/**
	 * Create a default out parameter based on the provided meta data.  This is used when no expicit
	 * parameter declaration has been made.
	 * @param parameterName the name of the parameter
	 * @param meta meta data used for this call
	 * @return the configured SqlOutParameter
	 */
	SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta);

	/**
	 * Create a default inout parameter based on the provided meta data.  This is used when no expicit
	 * parameter declaration has been made.
	 * @param parameterName the name of the parameter
	 * @param meta meta data used for this call
	 * @return the configured SqlInOutParameter
	 */
	SqlParameter createDefaultInOutParameter(String parameterName, CallParameterMetaData meta);

	/**
	 * Create a default in parameter based on the provided meta data.  This is used when no expicit
	 * parameter declaration has been made.
	 * @param parameterName the name of the parameter
	 * @param meta meta data used for this call
	 * @return the configured SqlParameter
	 */
	SqlParameter createDefaultInParameter(String parameterName, CallParameterMetaData meta);

	/**
	 * Get the name of the current user.  Useful for meta data lookups etc.
	 * @return current user name from database connection
	 */
	String getUserName();

	/**
	 * Does this database support returning resultsets that should be retreived with the JDBC call
	 * {@link java.sql.Statement#getResultSet()}
	 */
	boolean isReturnResultSetSupported();

	/**
	 * Does this database support returning resultsets as ref cursors to be retreived with
	 * {@link java.sql.CallableStatement#getObject(int)} for the specified column.
	 */
	boolean isRefCursorSupported();

	/**
	 * Get the {@link java.sql.Types} type for columns that return resultsets as ref cursors if this feature
	 * is supported.
	 */
	int getRefCursorSqlType();

	/**
	 * Are we using the meta data for the procedure columns?
	 */
	boolean isProcedureColumnMetaDataUsed();

	/**
	 * Should we bypass the return parameter with the specified name.
	 * This allows the database specific implementation to skip the processing
	 * for specific results returned by the database call.
	 */
	boolean byPassReturnParameter(String parameterName);

	/**
	 * Get the call parameter metadata that is currently used.
	 * @return List of {@link CallParameterMetaData}
	 */
	List<CallParameterMetaData> getCallParameterMetaData();

	/**
	 * Does the database support the use of catalog name in procedure calls
	 */
	boolean isSupportsCatalogsInProcedureCalls();

	/**
	 * Does the database support the use of schema name in procedure calls
	 */
	boolean isSupportsSchemasInProcedureCalls();

}

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework CallMetaDataProvider.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.