com.distelli.persistence.Schema Maven / Gradle / Ivy
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);
}