Author: dlanglais Date: 2010-01-26 22:16:50 +0100 (Tue, 26 Jan 2010) New Revision: 20 Added: trunk/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java Log: Cr?\195?\169ation d'une "vraie" interface BigTable. L'actuelle interface BigTable.java servant ?\195?\160 tester des plugins simples... -> In a future not very far away, nvBigTable will be "BigTable", and our current BigTable won't survive... ^^ Added: trunk/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java =================================================================== --- trunk/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java (rev 0) +++ trunk/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java 2010-01-26 21:16:50 UTC (rev 20) @@ -0,0 +1,137 @@ + +import java.util.Map; +import java.util.Set; + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * The interface for all the BigTable implementations. + * @author Dorian Langlais + */ +public interface nvBigTable { + + /** + * Connects to the database. + * @param host the server + * @param port the port + * @param base the base name + * @param username the user login + * @param passwd the user password + * @return return true if connexion is established, else return false. + */ + boolean connect( + String host, int port, String base, String username,String passwd); + + /****************** + * Tables * + ******************/ + + /** + * Selects the table. + * @param table the table to select + */ + void selectTable(String table); + + /** + * Create a new table in the base. + * @param table the name of the new table + */ + void createTable(String table); + + /** + * Delete a table in the base. + * @param table the table of the table to delete + */ + void deleteTable(String table); + + /** + * Get the tables' name which are in the base. + * @return Return a set containing the tables' name + */ + Set<String> getTablesNames(); + + + /******************* + * Columns * + *******************/ + + /** + * Create a new column in a table. + * Add a column <b>column</b> in the table <b>table</b> + * @param table the table name + * @param column the column name + */ + void createColumn(String table, String column); + + /** + * Delete a column in a table. + * Delete the column <b>column</b> in the table <b>table</b> + * @param table the table name + * @param column the column name + */ + void deleteColumn(String table, String column); + + /** + * Get the columns' name. + * @return Return a set containing the columns' name. + */ + Set<String> getColumnsNames(); + + /*************** + * Cell * + ***************/ + + /** + * Put a new content in the table. + * Put a new <b>content</b> in the column <b>column</b> of the table + * <b>table</b> with the key <b>key</b>. + * @param table the table name + * @param column the column name + * @param key the key + * @param content the content to add + */ + void put(String table, String column, String key, String content); + + /** + * Get a content in the table. + * Get a content in the table <b>table</b> from the column <b>column</b> + * where the key is <b>key</b>. + * -> get the last value (with the greater timestamp). + * @param table the table name. + * @param column the column name. + * @param key the key + * @return the content + */ + String get(String table, String column, String key); + + /** + * Get a content in the table. + * Get a content in the table <b>table</b> from the column <b>column</b> + * where the key is <b>key</b>. + * -> get the content with the version <b>version</b>. + * @param table the table name. + * @param column the column name. + * @param key the key + * @param version + * @return the content + */ + String get(String table, String column, String key, int version); + + /** + * Get the row identified by the key <b>key<b> from the table <b>table</b> + * @param table the table name + * @param key the key + * @return a Map with key is column's name and value is content's value. + */ + Map<String, String> getRow(String table, String key); + + /** + * Get the keys from a table. + * @param table the table + * @return return a Set containing the keys a the table <b>table</b>. + */ + Set<String> getKeys(String table); +}