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

dk.eobjects.metamodel.JdbcDataContextFactory Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
/**
 *  This file is part of MetaModel.
 *
 *  MetaModel is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  MetaModel is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with MetaModel.  If not, see .
 */
package dk.eobjects.metamodel;

import java.sql.Connection;

import javax.sql.DataSource;

import dk.eobjects.metamodel.schema.TableType;

public class JdbcDataContextFactory {

	public static final TableType[] DEFAULT_TABLE_TYPES = new TableType[] {
			TableType.TABLE, TableType.VIEW };

	public static DataContext getDataContext(Connection connection) {
		return new DataContext(new JdbcDataContextStrategy(connection,
				DEFAULT_TABLE_TYPES, null));
	}

	public static DataContext getDataContext(DataSource ds) {
		return new DataContext(new JdbcDataContextStrategy(ds,
				DEFAULT_TABLE_TYPES, null));
	}

	public static DataContext getDataContext(Connection connection,
			String catalogName) {
		return new DataContext(new JdbcDataContextStrategy(connection,
				DEFAULT_TABLE_TYPES, catalogName));
	}

	public static DataContext getDataContext(Connection connection,
			TableType... tableTypes) {
		return new DataContext(new JdbcDataContextStrategy(connection,
				tableTypes, null));
	}

	public static DataContext getDataContext(Connection connection,
			String catalogName, TableType[] tableTypes) {
		return new DataContext(new JdbcDataContextStrategy(connection,
				tableTypes, catalogName));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy