r63 - in trunk: mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap
Author: dlanglais Date: 2010-02-08 03:47:16 +0100 (Mon, 08 Feb 2010) New Revision: 63 Added: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/NewBigTable.java Removed: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/Core.java trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/MainTestCore.java trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java Log: Am?\195?\169lioration code... log au lieu de e.printStackTrace() -> oubli de certains.. remplacement des log.error(e) par log.error(e,e).. Renommage nvBigTable en NewBigTable (convention de nommage de classe...). Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/Core.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/Core.java 2010-02-07 18:59:13 UTC (rev 62) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/Core.java 2010-02-08 02:47:16 UTC (rev 63) @@ -7,18 +7,25 @@ import java.util.List; import java.util.HashMap; import java.util.Map; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.mapstoragemanager.plugins.BigTable; /** * Class Core. * This class permit to manage plugins. - * @author E054030D + * @author Gilles Crieloue * */ public class Core { /** + * Logger. + */ + private static final Log log = LogFactory.getLog(Core.class); + + /** * A map "name of the plugin" - "plugin instance". */ private Map < String, BigTable > bases = @@ -39,13 +46,15 @@ pluginLoader = new PluginLoader( new URL[]{directory.toURI().toURL()}, this.getClass().getClassLoader()); - } catch (Exception e1) { - e1.printStackTrace(); + } catch (Exception e) { + //e.printStackTrace(); + log.error(e.toString(), e); } try { loadAvailableBases(); } catch (IOException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } } @@ -66,9 +75,11 @@ bases.put(tmpClass.getName(), (BigTable) tmpClass.newInstance()); } catch (InstantiationException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } catch (IllegalAccessException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } } } Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/MainTestCore.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/MainTestCore.java 2010-02-07 18:59:13 UTC (rev 62) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/MainTestCore.java 2010-02-08 02:47:16 UTC (rev 63) @@ -6,6 +6,9 @@ public class MainTestCore { + /** + * Logger. + */ private static final Log log = LogFactory.getLog(MainTestCore.class); /** @@ -29,5 +32,4 @@ } } - } Modified: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-02-07 18:59:13 UTC (rev 62) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-02-08 02:47:16 UTC (rev 63) @@ -53,8 +53,8 @@ try { this.addURL(file.toURI().toURL()); } catch (MalformedURLException e) { - e.printStackTrace(); - log.error(e); + //e.printStackTrace(); + log.error(e.toString(), e); } } } @@ -72,7 +72,8 @@ log.info("== LIB " + file.getAbsolutePath() + "..."); this.addURL(file.toURI().toURL()); } catch (MalformedURLException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } } } @@ -101,7 +102,8 @@ try { jar = new JarFile(file.getAbsolutePath()); } catch (IOException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } // Enumeration < JarEntry > entries2 = jar.entries(); 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 18:59:13 UTC (rev 62) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/HBase.java 2010-02-08 02:47:16 UTC (rev 63) @@ -2,6 +2,8 @@ import java.io.IOException; import java.util.HashSet; import java.util.Set; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.nuiton.mapstoragemanager.plugins.BigTable; import org.apache.hadoop.hbase.HBaseConfiguration; @@ -15,6 +17,11 @@ public class HBase implements BigTable { + /** + * Logger. + */ + private static final Log log = LogFactory.getLog(HBase.class); + private HBaseConfiguration config; private HTable table; private String familyName = "mylittlecolumnfamily"; @@ -28,7 +35,7 @@ // be found on the CLASSPATH org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(); config = new HBaseConfiguration(conf); - System.out.println("test"); + log.info("test"); selectTable(tableName); put("test", "val"); put("test", "val2"); @@ -112,7 +119,8 @@ scanner = table.getScanner(s); } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } try { // Scanners return Result instances. @@ -126,7 +134,8 @@ } catch (IOException e) { // TODO Auto-generated catch block - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } // The other approach is to use a foreach loop. Scanners are iterable! @@ -148,7 +157,8 @@ try { table = new HTable(config, tableName); } catch (IOException e) { - e.printStackTrace(); + //e.printStackTrace(); + log.error(e.toString(), e); } } Added: trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/NewBigTable.java =================================================================== --- trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/NewBigTable.java (rev 0) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/NewBigTable.java 2010-02-08 02:47:16 UTC (rev 63) @@ -0,0 +1,131 @@ +package org.nuiton.mapstoragemanager.plugins; + +import java.util.Map; +import java.util.Set; + +/** + * The interface for all the BigTable implementations. + * @author Dorian Langlais + */ +public interface NewBigTable { + + /** + * 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 of one table. + * @param table the table name + * @return Return a set containing the columns' name of the table + * <b>table</b> + */ + Set<String> getColumnsNames(String table); + + /*************** + * 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); +} Deleted: 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 18:59:13 UTC (rev 62) +++ trunk/mapstoragemanagerarch/src/main/java/org/nuiton/mapstoragemanager/plugins/nvBigTable.java 2010-02-08 02:47:16 UTC (rev 63) @@ -1,131 +0,0 @@ -package org.nuiton.mapstoragemanager.plugins; - -import java.util.Map; -import java.util.Set; - -/** - * 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 of one table. - * @param table the table name - * @return Return a set containing the columns' name of the table - * <b>table</b> - */ - Set<String> getColumnsNames(String table); - - /*************** - * 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); -} 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 18:59:13 UTC (rev 62) +++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/BigHashMap.java 2010-02-08 02:47:16 UTC (rev 63) @@ -3,14 +3,14 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -import org.nuiton.mapstoragemanager.plugins.nvBigTable; +import org.nuiton.mapstoragemanager.plugins.NewBigTable; /** * Interface listant les méthodes nécéssaires sur une base de données. * @author Dorian Langlais * */ -public class BigHashMap implements nvBigTable { +public class BigHashMap implements NewBigTable { /** * tables.
participants (1)
-
dlanglais@users.nuiton.org