View Javadoc
1   /*
2    * Copyright 2002-2012 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.jdbc.support;
18  
19  import java.sql.DatabaseMetaData;
20  import java.sql.SQLException;
21  
22  /**
23   * A callback interface used by the JdbcUtils class. Implementations of this
24   * interface perform the actual work of extracting database meta data, but
25   * don't need to worry about exception handling. SQLExceptions will be caught
26   * and handled correctly by the JdbcUtils class.
27   *
28   * @author Thomas Risberg
29   * @see JdbcUtils#extractDatabaseMetaData
30   */
31  public interface DatabaseMetaDataCallback {
32  
33  	/**
34  	 * Implementations must implement this method to process the meta data
35  	 * passed in. Exactly what the implementation chooses to do is up to it.
36  	 * @param dbmd the DatabaseMetaData to process
37  	 * @return a result object extracted from the meta data
38  	 * (can be an arbitrary object, as needed by the implementation)
39  	 * @throws SQLException if a SQLException is encountered getting
40  	 * column values (that is, there's no need to catch SQLException)
41  	 * @throws MetaDataAccessException in case of other failures while
42  	 * extracting meta data (for example, reflection failure)
43  	 */
44  	Object processMetaData(DatabaseMetaData dbmd) throws SQLException, MetaDataAccessException;
45  
46  }