001package co.codewizards.cloudstore.local.db;
002
003public interface DatabaseAdapterFactory {
004
005        /**
006         * Configuration property key used to select a certain database adapter. If this is not specified or set
007         * to an empty value, the adapter with the highest {@link #getPriority() priority} is used.
008         */
009        String CONFIG_KEY_DATABASE_ADAPTER_NAME = "databaseAdapter.name";
010
011        /**
012         * Default value for {@link #CONFIG_KEY_DATABASE_ADAPTER_NAME} (applicable, if not specified by user).
013         */
014        String DEFAULT_DATABASE_ADAPTER_NAME = null;
015
016        /**
017         * Gets the symbolic name of this adapter.
018         * <p>
019         * Usually, this matches the JDBC-sub-protocol-name of the database being used (e.g. "derby" or "mysql"), but
020         * in case there are multiple adapters for the same database type, they must have a different name.
021         * <p>
022         * This symbolic name must be unique. It can be used via the configuration property {@link #CONFIG_KEY_DATABASE_ADAPTER_NAME}
023         * to force a certain adapter.
024         * @return the symbolic name of this adapter. Must not be <code>null</code>, must not be empty and
025         * must not contain spaces.
026         */
027        String getName();
028
029        int getPriority();
030
031        DatabaseAdapter createDatabaseAdapter();
032}