polish
This commit is contained in:
parent
567dd1eefb
commit
f64dcd379e
|
|
@ -16,7 +16,8 @@
|
||||||
package org.springframework.jdbc.datasource.embedded;
|
package org.springframework.jdbc.datasource.embedded;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows DataSource connection properties to be configured in a DataSource implementation independent manner.
|
* DataSourceFactory helper that allows essential JDBC connection properties to be configured consistently,
|
||||||
|
* independent of the actual DataSource implementation.
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
* @see DataSourceFactory
|
* @see DataSourceFactory
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import javax.sql.DataSource;
|
||||||
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A factory for DataSource implementation, such as a {@link SimpleDriverDataSource} or connection pool such as Apache DBCP or c3p0.
|
* Encapsulates the creation of a particular DataSource implementation, such as a {@link SimpleDriverDataSource} or connection pool such as Apache DBCP or c3p0.
|
||||||
* Call {@link #getConnectionProperties()} to configure normalized DataSource properties before calling {@link #getDataSource()} to actually get the configured DataSource instance.
|
* Call {@link #getConnectionProperties()} to configure normalized DataSource properties before calling {@link #getDataSource()} to actually get the configured DataSource instance.
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strategy for populating a database with data.
|
* Strategy used to populate an embedded database during initialization.
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
* @see ResourceDatabasePopulator
|
* @see ResourceDatabasePopulator
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ package org.springframework.jdbc.datasource.embedded;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Package private factory for mapping well-known {@link EmbeddedDatabaseType embedded database types} to
|
* Maps well-known {@link EmbeddedDatabaseType embedded database types} to
|
||||||
* {@link EmbeddedDatabaseConfigurer} strategies.
|
* {@link EmbeddedDatabaseConfigurer} strategies.
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link EmbeddedDatabase} instance pre-populated with test data. When the database is returned, callers are
|
* Creates a {@link EmbeddedDatabase} instance.
|
||||||
* guaranteed that the database schema and test data will have already been loaded.
|
* Callers are guaranteed that the returned database has been fully initialized and populated.
|
||||||
* <p>
|
* <p>
|
||||||
* Can be configured:<br>
|
* Can be configured:<br>
|
||||||
* Call {@link #setDatabaseName(String)} to change the name of the database.<br>
|
* Call {@link #setDatabaseName(String)} to change the name of the database.<br>
|
||||||
* Call {@link #setDatabaseType(EmbeddedDatabaseType)} to set the database type if you wish to use one of the supported types.<br>
|
* Call {@link #setDatabaseType(EmbeddedDatabaseType)} to set the database type if you wish to use one of the supported types.<br>
|
||||||
* Call {@link #setDatabaseConfigurer(EmbeddedDatabaseConfigurer)} to set a configuration strategy for your own embedded database type.<br>
|
* Call {@link #setDatabaseConfigurer(EmbeddedDatabaseConfigurer)} to configure support for your own embedded database type.<br>
|
||||||
* Call {@link #setDatabasePopulator(DatabasePopulator)} to change the algorithm used to populate the database.<br>
|
* Call {@link #setDatabasePopulator(DatabasePopulator)} to change the algorithm used to populate the database.<br>
|
||||||
* Call {@link #setDataSourceFactory(DataSourceFactory)} to change the type of DataSource used to connect to the database.<br>
|
* Call {@link #setDataSourceFactory(DataSourceFactory)} to change the type of DataSource used to connect to the database.<br>
|
||||||
* Call {@link #getDatabase()} to get the {@link EmbeddedDatabase} instance.<br>
|
* Call {@link #getDatabase()} to get the {@link EmbeddedDatabase} instance.<br>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package org.springframework.jdbc.datasource.embedded;
|
||||||
/**
|
/**
|
||||||
* A supported embedded database type.
|
* A supported embedded database type.
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
* @see HsqlEmbeddedDatabaseConfigurer
|
|
||||||
*/
|
*/
|
||||||
public enum EmbeddedDatabaseType {
|
public enum EmbeddedDatabaseType {
|
||||||
HSQL;
|
HSQL;
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,11 @@ import org.springframework.util.StringUtils;
|
||||||
/**
|
/**
|
||||||
* Populates a database from schema and test-data SQL defined in external resources. By default, looks for a schema.sql
|
* Populates a database from schema and test-data SQL defined in external resources. By default, looks for a schema.sql
|
||||||
* file and test-data.sql resource in the root of the classpath.
|
* file and test-data.sql resource in the root of the classpath.
|
||||||
*
|
* <p>
|
||||||
* May be configured. Call {@link #setSchemaLocation(Resource)} to configure the location of the database schema file.
|
* May be configured:<br>
|
||||||
* Call {@link #setTestDataLocation(Resource)} to configure the location of the test data file. Call
|
* Call {@link #setSchemaLocation(Resource)} to configure the location of the database schema file.<br>
|
||||||
* {@link #setSqlScriptEncoding(String)} to set the encoding for the schema and test data SQL.
|
* Call {@link #setTestDataLocation(Resource)} to configure the location of the test data file.<br>
|
||||||
|
* Call {@link #setSqlScriptEncoding(String)} to set the encoding for the schema and test data SQL.<br>
|
||||||
*/
|
*/
|
||||||
public class ResourceDatabasePopulator implements DatabasePopulator {
|
public class ResourceDatabasePopulator implements DatabasePopulator {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2002-2009 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.datasource.embedded;
|
package org.springframework.jdbc.datasource.embedded;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link SimpleDriverDataSource}.
|
||||||
|
* @author Keith Donald
|
||||||
|
*/
|
||||||
final class SimpleDriverDataSourceFactory implements DataSourceFactory {
|
final class SimpleDriverDataSourceFactory implements DataSourceFactory {
|
||||||
|
|
||||||
private SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
|
private SimpleDriverDataSource dataSource = new SimpleDriverDataSource();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue