Author: dlanglais Date: 2010-02-07 02:05:18 +0100 (Sun, 07 Feb 2010) New Revision: 57 Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap.java trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellImpl.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnImpl.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureImpl.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableImpl.java Log: Apr?\195?\168s un petit passage sur sonar, j'ai d?\195?\169cid?\195?\169 de corriger quelques erreurs "checkstyle"... Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java 2010-02-07 01:05:18 UTC (rev 57) @@ -1,5 +1,4 @@ import java.io.IOException; -import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import org.nuiton.mapstoragemanager.plugins.BigTable; Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap.java 2010-02-07 01:05:18 UTC (rev 57) @@ -3,31 +3,28 @@ import java.util.HashMap; import java.util.Set; -public class OurHashMap implements BigTable{ +public class OurHashMap implements BigTable { - HashMap<String,String> map = new HashMap<String, String>(); - - public String get(String key) { - return map.get(key); - } + HashMap<String, String> map = new HashMap<String, String>(); - public Set<String> getKeys() { - return map.keySet(); - } + public String get(String key) { + return map.get(key); + } - public void put(String key, String value) { - map.put(key, value); - } + public Set<String> getKeys() { + return map.keySet(); + } - public void connect(String host, String base, String username, - String password) { - // TODO Auto-generated method stub - - } + public void put(String key, String value) { + map.put(key, value); + } - public void selectTable(String table) { - // TODO Auto-generated method stub - - } + public void connect(String host, String base, String username, + String password) { + // TODO Auto-generated method stub + } + public void selectTable(String table) { + // TODO Auto-generated method stub + } } Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java 2010-02-07 01:05:18 UTC (rev 57) @@ -9,127 +9,123 @@ */ public interface nvBigTable { - /** + /** * Connects to the database. * @param host the server - * @param port the port + * @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. + * @return return true if connexion is established, else return false. */ - boolean connect( - String host, int port, String base, String username,String passwd); + boolean connect( + String host, int port, String base, String username, String passwd); - /****************** - * Tables * - ******************/ - + /****************** + * 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); + /** + * 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); + /** + * 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(); + /** + * 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); - /******************* - * Columns * - *******************/ + /** + * 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); - /** - * 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 of one table. + /** + * Get the columns' name of one table. * @param table the table name - * @return Return a set containing the columns' name of the table + * @return Return a set containing the columns' name of the table * <b>table</b> - */ - Set<String> getColumnsNames(String table); + */ + Set<String> getColumnsNames(String table); - /*************** - * Cell * - ***************/ + /*************** + * 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); - /** - * 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 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 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 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); + /** + * 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); } Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java =================================================================== --- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java 2010-02-07 01:05:18 UTC (rev 57) @@ -12,7 +12,15 @@ */ public class BigHashMap implements nvBigTable { + /** + * tables. + * hashMap with value is table, and key its name. + */ private Map<String, Table> tables; + /** + * currentTable. + * the table which is selected. + */ private Table currentTable; /** Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellImpl.java =================================================================== --- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellImpl.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellImpl.java 2010-02-07 01:05:18 UTC (rev 57) @@ -12,8 +12,7 @@ * @author dorian Langlais, amaury Fages, gilles Crieloue, florent Gilet. * @licence GPL. */ -public class CellImpl<T /**extends Serializable*/ - > implements Cell<T> { +public class CellImpl<T> implements Cell<T> { /** * cell. @@ -56,7 +55,7 @@ * {@inheritDoc} */ public final T get() { - if (cell.size() == 0) { + if (this.cell.isEmpty()) { throw new NoSuchElementException(); } Long max = 0L; @@ -72,7 +71,7 @@ * {@inheritDoc} */ public int hashCode() { - if (this.cell.size() != 0) { + if (! this.cell.isEmpty()) { return this.get().hashCode(); } else { return 0; @@ -88,7 +87,7 @@ if (o instanceof CellImpl) { CellImpl another = (CellImpl) o; if(this.cell.size() == another.cell.size()) { - if(this.cell.size() == 0) { + if(this.cell.isEmpty()) { return true; } else { return this.get().equals(another.get()); @@ -105,7 +104,7 @@ */ public String toString() { - if (this.cell.size() != 0) { + if (! this.cell.isEmpty()) { return ((T) this.get()).toString(); } else { return ""; Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnImpl.java =================================================================== --- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnImpl.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnImpl.java 2010-02-07 01:05:18 UTC (rev 57) @@ -11,8 +11,7 @@ * @author dorian Langlais, amaury Fages, gilles Crieloue, florent Gilet. * @licence GPL. */ -public class ColumnImpl<T /**extends Serializable*/ - > implements Column<T> { +public class ColumnImpl<T> implements Column<T> { /** * column. Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureImpl.java =================================================================== --- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureImpl.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureImpl.java 2010-02-07 01:05:18 UTC (rev 57) @@ -16,24 +16,21 @@ * structure. * hashMap with key the column name, and value the column class. */ - private Map<String, Class<? /**extends Serializable*/ - >> structure; + private Map<String, Class<?>> structure; /** * Default constructor. */ public StructureImpl() { this.structure = - new HashMap<String, Class<? /**extends Serializable*/ - >>(); + new HashMap<String, Class<?>>(); } /** * {@inheritDoc} */ public final void createColumn(final String columnName, - final Class<? /**extends Serializable*/ - > columnClass) { + final Class<?> columnClass) { this.structure.put(columnName, columnClass); } @@ -47,8 +44,7 @@ /** * {@inheritDoc} */ - public final Class<? /**extends Serializable*/ - > getColumnClass( + public final Class<?> getColumnClass( final String columnName) { return this.structure.get(columnName); } Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableImpl.java =================================================================== --- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableImpl.java 2010-02-07 00:32:05 UTC (rev 56) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableImpl.java 2010-02-07 01:05:18 UTC (rev 57) @@ -34,9 +34,8 @@ /** * {@inheritDoc} */ - public final <columnClass /**extends Serializable*/ - > void createColumn( - final String columnName, final Class<?> columnClass) { + public final <columnClass> void createColumn(final String columnName, + final Class<?> columnClass) { ColumnImpl<columnClass> column = new ColumnImpl<columnClass>(); this.tableColumns.put(columnName, column); this.tableStructure.createColumn(columnName, columnClass); @@ -54,11 +53,9 @@ * {@inheritDoc} */ public final Row getRow(final String key) { - Map<String, Object> rowContent = - new HashMap<String, Object>(); + Map<String, Object> rowContent = new HashMap<String, Object>(); for (String columnName : tableStructure.getColumnsNames()) { - rowContent.put(columnName, - tableColumns.get(columnName).get(key)); + rowContent.put(columnName, tableColumns.get(columnName).get(key)); } return new RowImpl(tableStructure, rowContent); }