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

com.distelli.persistence.Schema Maven / Gradle / Ivy

There is a newer version: 3.8.16
Show newest version
package com.distelli.persistence;

import java.net.URI;
import java.util.Collection;
import com.distelli.cred.CredProvider;

public interface Schema {
    public interface Builder {
        /**
         * URI format:
         *    DynamoDB (always connects over SSL):
         *
         *       ddb://<region|endpoint>/
         *
         *    MySQL (always connects over SSL):
         *
         *       mysql://<host>:<port>/
         *
         * @param endpoint is the endpoint to use.
         *
         * @return this
         */
        public Builder withEndpoint(URI endpoint);

        /**
         * @param credProvider is used to obtain the DB username and
         *        password (or key id and secret key).
         *
         * @return this
         */
        public Builder withCredProvider(CredProvider credProvider);

        /**
         * @param proxyEndpoint is the HTTP proxy to use, or null if no proxy is needed.
         *
         * @return this
         */
        public Builder withProxy(URI proxyEndpoint);

        /**
         * @param tableNameFormatStr is use to add a table name prefix or suffix.
         *        This string is passed as the first argument to String.format().
         *
         * @return this
         */
        public Builder withTableNameFormat(String tableNameFormatStr);

        /**
         * @return the schema implementation based on the builder parameters.
         */
        public Schema build();
    }

    public interface Factory {
        public Builder create();
    }

    /**
     * Introspects the database tables, if the table is missing, create the table.
     * If an index on the table is missing, create the missing index.
     *
     * @param tables - the tables to create.
     */
    public void createMissingTablesOrIndexes(Collection tables);

    /**
     * NOTE: tableName is AFTER tableNameFormat has been applied.
     */
    public TableDescription getTableDescription(String tableName);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy