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

org.fuchss.objectcasket.tablemodule.port.ModuleConfiguration Maven / Gradle / Ivy

Go to download

Object Casket is a simple O/R mapper that can be used together with the Java Persistence API (JPA). The aim is to provide a simple solution for small projects to store multi-related entities in a simple manner.

There is a newer version: 0.20.17
Show newest version
package org.fuchss.objectcasket.tablemodule.port;

import org.fuchss.objectcasket.common.CasketException;
import org.fuchss.objectcasket.sqlconnector.port.DialectH2;
import org.fuchss.objectcasket.sqlconnector.port.DialectSqlite;
import org.fuchss.objectcasket.sqlconnector.port.SqlDialect;

import java.sql.Driver;

/**
 * A set of information to access the underlying database or create a new one.
 */
public interface ModuleConfiguration {

	/**
	 * This operation sets driver, driver prefix, and dialect specific names.
* E.g. driver = org.sqlite.JDBC.class and driverPrefix = * jdbc:sqlite: *

* One can use one of the predefined dialects {@link DialectH2} or * {@link DialectSqlite}, or create one's own. * * @param driver - the driver class. * @param driverPrefix - the driver prefix for the URL. * @param dialect - dialect specific names for SQL types and annotations. * @return success or not. This means a new class and/or driver name were * registered. * @throws CasketException on error. */ boolean setDriver(Class driver, String driverPrefix, SqlDialect dialect) throws CasketException; /** * This operation sets the database URI. * * @param uri - the URI. * @return success or not. This means the registered URI was set or has changed * - not more. * @throws CasketException on error. */ boolean setUri(String uri) throws CasketException; /** * This operation sets the username for the database. If database and user * exist, the user's permissions should be sufficient to work with the database. * Object Casket does not yet support a role concept. * * @param name - the user name. * @return success or not. This means the registered username was set or has * changed - not more. * @throws CasketException on error. */ boolean setUser(String name) throws CasketException; /** * This operation sets the password for the database. Whether access is granted * or not will be known as soon as a connection can be established or not. * * @param password - the password. * @return success or not. This means the registered password was set or has * changed - not more. * @throws CasketException on error. * @see TableModuleFactory#newTableModule(ModuleConfiguration) */ boolean setPassword(String password) throws CasketException; /** * This operation sets {@link Flag Flags} for this configuration. * * @param flags - the flags. * @return success or not. This means the set of flags has changed. * @throws CasketException on error. */ boolean setFlag(Flag... flags) throws CasketException; /** * This operation removes {@link Flag Flags} for this configuration. * * @param flags - the flags. * @return success or not. This means the set of flags has changed. * @throws CasketException on error. */ boolean removeFlag(Flag... flags) throws CasketException; /** * This operation checks whether {@link Flag Flags} are set. * * @param flags - the flags. * @return true iff all flags are set. * @throws CasketException on error. */ boolean containsAll(Flag... flags) throws CasketException; /** * This operation checks whether the configuration has an assigned table module. * * @return true iff there are assigned table modules. */ boolean inUse(); /** * Possible flags to configure a table module. */ enum Flag { /** * Allow file and table creation. */ CREATE, /** * Allow DB modification. */ MODIFY } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy