Mapstoragemanager-commits
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
February 2010
- 7 participants
- 101 discussions
r150 - in trunk: msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2 msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 18:58:02 +0100 (Sun, 28 Feb 2010)
New Revision: 150
Added:
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java
Modified:
trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java
trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java
Log:
ajout des package-info.java manquants.
Modified: trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java
===================================================================
--- trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java 2010-02-28 17:51:58 UTC (rev 149)
+++ trunk/msm-bighashmap/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmap/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -1,6 +1,6 @@
package org.nuiton.mapstoragemanager.plugins.bighashmap;
/**
* package BigHashMap.
- * permet la représentation sous forme de hashMap d'une base de données selon
+ * Permet la représentation sous forme de hashMap d'une base de données selon
* la spécification bigTable.
*/
Modified: trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java
===================================================================
--- trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java 2010-02-28 17:51:58 UTC (rev 149)
+++ trunk/msm-bighashmapV2/src/main/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -1,6 +1,6 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
/**
* package BigHashMap.
- * permet la représentation sous forme de hashMap d'une base de données selon
+ * Permet la représentation sous forme de hashMap d'une base de données selon
* la spécification bigTable.
*/
Added: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java (rev 0)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.exporter;
+/**
+ * package exporter.
+ * Permet l'export dans un format XML d'une base bigtable.
+ */
Added: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java (rev 0)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,6 @@
+package org.nuiton.mapstoragemanager.plugins.importer;
+/**
+ * package importer.
+ * Permet l'import dans une base bigtable du contenu d'une base bigtable stockée
+ * dans un fichier XML.
+ */
Added: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java (rev 0)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/package-info.java 2010-02-28 17:58:02 UTC (rev 150)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+/**
+ * package hbase.
+ * Permet de se connecter à une base HBase.
+ */
1
0
r149 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 18:51:58 +0100 (Sun, 28 Feb 2010)
New Revision: 149
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Nettoyage code :
- suppression import inutilis?\195?\169es ;
- mise en priv?\195?\169 des attributs de classe.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -7,8 +7,6 @@
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
@@ -46,7 +44,7 @@
/**
* OurHashMap2.
*/
- OurHashMap2 ohm;
+ private OurHashMap2 ohm;
/**
* classe instance (singleton pattern).
@@ -246,12 +244,12 @@
* Informations about team.
*/
public void showAbout() {
- String message="Developers :"+"\n";
- message+=" Gilles Crieloue"+"\n";
- message+=" Amaury Fages"+"\n";
- message+=" Florent Gilet"+"\n";
- message+=" Langlais Dorian"+"\n";
- message+="Version 1.0 Codelutin @ 2009-2010";
+ String message = "Developers :" + "\n";
+ message += " Gilles Crieloue" + "\n";
+ message += " Amaury Fages" + "\n";
+ message += " Florent Gilet" + "\n";
+ message += " Langlais Dorian" + "\n";
+ message += "Version 0.1-SNAPSHOT Codelutin @ 2009-2010";
JOptionPane.showMessageDialog(null, message);
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,8 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
import java.util.Iterator;
@@ -22,12 +17,12 @@
/**
* columnNames.
*/
- String[] titres;
+ private String[] titres;
/**
* data.
*/
- String[][] data;
+ private String[][] data;
/**
* Constructor.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,6 +1,7 @@
package org.nuiton.mapstoragemanager.ui.gui;
-import javax.swing.tree.*;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
/**
* Model of the navigation tree.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,21 +1,10 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.ScrollPaneLayout;
-import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
-import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.ui.MainUI;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:46:09 UTC (rev 148)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:51:58 UTC (rev 149)
@@ -1,8 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
package org.nuiton.mapstoragemanager.ui.gui;
import java.util.Iterator;
@@ -11,8 +6,6 @@
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
-import static org.nuiton.i18n.I18n.n_;
-
/**
* Model of a table content
* @author E045231P
@@ -23,12 +16,12 @@
/**
* columnNames.
*/
- String[] titles;
+ private String[] titles;
/**
* data.
*/
- String[][] data;
+ private String[][] data;
/**
* Show the keys in the table or not.
1
0
r148 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 18:46:09 +0100 (Sun, 28 Feb 2010)
New Revision: 148
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
J'ai l?\195?\169g?\195?\168rement modifi?\195?\169 TableModel pour tout de m?\195?\170me afficher (ou non) les cl?\195?\169s de la table (d?\195?\169sactivable ?\195?\160 l'aide d'un bool?\195?\169en).
Il est dommage d'avoir supprim?\195?\169 les commentaires javadoc, j'ai rajout?\195?\169 les commentaires h?\195?\169rit?\195?\169s.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:23:08 UTC (rev 147)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 17:46:09 UTC (rev 148)
@@ -55,26 +55,41 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getColumnCount() {
return titres.length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getRowCount() {
return data[0].length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getColumnName(int col){
return titres[col];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public boolean isCellEditable(int row, int col) {
return false;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:23:08 UTC (rev 147)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 17:46:09 UTC (rev 148)
@@ -31,6 +31,11 @@
String[][] data;
/**
+ * Show the keys in the table or not.
+ */
+ private static boolean showTableKeys = true;
+
+ /**
* Constructor.
*/
public TableModel(DefaultMutableTreeNode node) {
@@ -39,49 +44,82 @@
OurHashMap2 hashmap = engine.getOurHashMap();
Set<String> columnsNames = hashmap.getColumnsNames(table);
- titles = new String[columnsNames.size()];
//content
- Set<String> keySetTable = hashmap.getKeys(table);
- Iterator i = columnsNames.iterator();
+ Set<String> keySetTable = hashmap.getKeys(table);
+ Iterator<String> columnName = columnsNames.iterator();
+
+ /**
+ * indexes
+ */
int colIndex=0;
int rowindex=0;
- data = new String[columnsNames.size()][keySetTable.size()];
- while(i.hasNext()){
- String titreTemp = (String)i.next();
+
+ if(showTableKeys) {
+ titles = new String[columnsNames.size() + 1];
+ titles[0] = "Keys";
+ data = new String[columnsNames.size() + 1][keySetTable.size()];
+ colIndex++;
+ } else {
+ titles = new String[columnsNames.size()];
+ data = new String[columnsNames.size()][keySetTable.size()];
+ }
+
+
+ while(columnName.hasNext()){
+ String titreTemp = columnName.next();
titles[colIndex] = titreTemp;
Set<String> columnKeys = hashmap.getKeys(table, titles[colIndex]);
- Iterator<String> i2 = columnKeys.iterator();
- while(i2.hasNext()){
- String str = hashmap.get(table,titreTemp,(String)i2.next());
- data[colIndex][rowindex]=str;
+ Iterator<String> columnKey = columnKeys.iterator();
+ while(columnKey.hasNext()){
+ String key = columnKey.next();
+ String str = hashmap.get(table, titreTemp, key);
+ if(showTableKeys) {
+ data[0][rowindex] = key;
+ }
+ data[colIndex][rowindex] = str;
rowindex++;
}
colIndex++;
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getColumnCount() {
return titles.length;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public int getRowCount() {
return data[0].length;
}
-
+
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getColumnName(int col){
return titles[col];
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public boolean isCellEditable(int row, int col) {
return false;
1
0
r147 - in trunk: msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2 msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 18:23:08 +0100 (Sun, 28 Feb 2010)
New Revision: 147
Modified:
trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java
trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java
trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java
trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java
trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java
trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java
trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java
trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java
trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java
trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
Log:
Utilisation du logger apache.commons.logging au lieu du logger java.util... (mis par d?\195?\169faut pour les exceptions).
variable Log renomm?\195?\169e en LOG
Les logs d'information d'exception "lev?\195?\169e correctement" transform?\195?\169s en log.trace() (et non erreur).
Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java
===================================================================
--- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/CellTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -19,7 +19,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(CellTest.class);
+ private static final Log LOG = LogFactory.getLog(CellTest.class);
private Cell<Object> cellActual;
private Cell<Object> cell2Actual;
@@ -36,7 +36,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -54,7 +54,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExcepted);
@@ -77,7 +77,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExcepted);
Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java
===================================================================
--- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/ColumnTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -17,7 +17,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(ColumnTest.class);
+ private static final Log LOG = LogFactory.getLog(ColumnTest.class);
private Column columnActual;
private Column column2Actual;
@@ -33,7 +33,7 @@
columnActual.get("test");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -49,7 +49,7 @@
columnActual.get("object 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
columnActual.put("object 1", expected);
@@ -82,7 +82,7 @@
columnActual.get("integer 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(columnActual.get("integer 2"), expected2);
@@ -94,7 +94,7 @@
columnActual.get("integer 2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java
===================================================================
--- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -11,7 +11,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(RowTest.class);
+ private static final Log LOG = LogFactory.getLog(RowTest.class);
private Structure structureExpected;
private Map<String, Object> contentExpected;
Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java
===================================================================
--- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/StructureTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -5,8 +5,6 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -17,7 +15,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(StructureTest.class);
+ private static final Log LOG = LogFactory.getLog(StructureTest.class);
private Structure structureActual;
private Map<String, Class<?>> structureContentActual;
@@ -64,13 +62,13 @@
assertEquals(structureContentExpected, structureContentActual);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -131,13 +129,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
Modified: trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java
===================================================================
--- trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmap/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/TableTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -10,8 +10,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -26,7 +24,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(TableTest.class);
+ private static final Log LOG = LogFactory.getLog(TableTest.class);
private Table tableActual;
private Structure tableStructureActual;
@@ -59,13 +57,13 @@
assertEquals(tableColumnsActual, tableColumnsExpected);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -120,13 +118,13 @@
assertEquals(tableColumnsActual, tableColumnsExpected);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -190,13 +188,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -243,13 +241,13 @@
assertEquals(expectedInteger2, tableColumns.get("Integer").get("integer2"));
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -465,7 +463,7 @@
tableActual.get("String", "string1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedString2, tableActual.get("String", "string2"));
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
@@ -476,7 +474,7 @@
tableActual.get("String", "string2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -486,7 +484,7 @@
tableActual.get("Integer", "integer1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -495,7 +493,7 @@
tableActual.get("Integer", "integer2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
}
Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java
===================================================================
--- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/CellTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,7 +1,5 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.CellImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Cell;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -21,7 +19,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(CellTest.class);
+ private static final Log LOG = LogFactory.getLog(CellTest.class);
private Cell cellActual;
private Cell cell2Actual;
@@ -38,7 +36,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -56,7 +54,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExpected1);
@@ -79,7 +77,7 @@
assertNull(cellActual.get());
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
cellActual.put(objectExpected1);
Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java
===================================================================
--- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/ColumnTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -17,7 +17,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(ColumnTest.class);
+ private static final Log LOG = LogFactory.getLog(ColumnTest.class);
private Column columnActual1;
private Column columnActual2;
@@ -33,7 +33,7 @@
columnActual1.get("test");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
}
@@ -49,7 +49,7 @@
columnActual1.get("object 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement");
+ LOG.trace("Exception levée correctement");
}
columnActual1.put("object 1", expected1);
@@ -82,7 +82,7 @@
columnActual1.get("integer 1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(columnActual1.get("integer 2"), expected2);
@@ -94,7 +94,7 @@
columnActual1.get("integer 2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java
===================================================================
--- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/RowTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,9 +1,5 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.StructureImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Row;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.RowImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Structure;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
@@ -15,7 +11,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(RowTest.class);
+ private static final Log LOG = LogFactory.getLog(RowTest.class);
private Structure structureExpected;
private Map<String, String> contentExpected;
Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java
===================================================================
--- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/StructureTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,12 +1,8 @@
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.StructureImpl;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.Structure;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -17,7 +13,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(StructureTest.class);
+ private static final Log LOG = LogFactory.getLog(StructureTest.class);
private Structure structureActual;
private Set<String> structureContentActual;
@@ -64,13 +60,13 @@
assertEquals(structureContentExpected, structureContentActual);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
@@ -131,13 +127,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
} catch (SecurityException ex) {
- Logger.getLogger(StructureTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex, ex);
}
}
Modified: trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java
===================================================================
--- trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-bighashmapV2/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmapv2/TableTest.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
package org.nuiton.mapstoragemanager.plugins.bighashmapv2;
import java.lang.reflect.Field;
@@ -10,8 +6,6 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.apache.commons.logging.LogFactory;
@@ -26,7 +20,7 @@
/**
* Logger.
*/
- private static final Log log = LogFactory.getLog(TableTest.class);
+ private static final Log LOG = LogFactory.getLog(TableTest.class);
private Table tableActual;
private Structure tableStructureActual;
@@ -61,13 +55,13 @@
tableColumnsExpected.toString());
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -128,13 +122,13 @@
tableColumnsExpected.toString());
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -204,13 +198,13 @@
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -257,13 +251,13 @@
assertEquals(expectedInteger2, tableColumns.get("Integer").get("integer2"));
} catch (NoSuchFieldException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (SecurityException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalArgumentException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
} catch (IllegalAccessException ex) {
- Logger.getLogger(TableTest.class.getName()).log(Level.SEVERE, null, ex);
+ LOG.fatal(ex,ex);
}
}
@@ -479,7 +473,7 @@
tableActual.get("String", "string1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedString2, tableActual.get("String", "string2"));
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
@@ -490,7 +484,7 @@
tableActual.get("String", "string2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger1, tableActual.get("Integer", "integer1"));
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -500,7 +494,7 @@
tableActual.get("Integer", "integer1");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
assertEquals(expectedInteger2, tableActual.get("Integer", "integer2"));
@@ -509,7 +503,7 @@
tableActual.get("Integer", "integer2");
Assert.fail();
} catch (NoSuchElementException e) {
- log.info("Exception levée correctement.");
+ LOG.trace("Exception levée correctement.");
}
}
}
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 16:50:11 UTC (rev 146)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 17:23:08 UTC (rev 147)
@@ -23,7 +23,10 @@
*/
private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
- private static boolean test = false;
+ /**
+ * trace or not.
+ */
+ private static boolean trace = false;
/**
* Test if to Element are equivalent.
@@ -34,8 +37,8 @@
public static void assertEquivalent(Element expected, Element actual)
throws AssertionFailedError {
- if(test) {
- System.out.println("---------------------------------------------");
+ if(trace) {
+ LOG.trace("------------------------------------------------------");
}
String expectedElementName = expected.getName();
@@ -81,8 +84,8 @@
}
}
- if(test) {
- LOG.info("Attribues"
+ if(trace) {
+ LOG.trace("Attribues"
+ '\n' + expectedAttributes
+ '\n' + actualAttributes
+ '\n' + "Children"
@@ -97,8 +100,8 @@
throw new AssertionFailedError();
// return;
} else if (expectedChildren.isEmpty()) {
- if(test) {
- LOG.info(expectedValue + '\n' + actualValue);
+ if(trace) {
+ LOG.trace(expectedValue + '\n' + actualValue);
}
if (!expected.getValue().equals(actual.getValue())) {
throw new AssertionFailedError();
@@ -121,7 +124,7 @@
TF = true;
}
catch (AssertionFailedError e) {
- LOG.error(e);
+ LOG.trace(e);
}
/*if (testEquals(expectedChild,actualChild)) {
// actualChildren.remove(actualChild);
@@ -141,8 +144,8 @@
}
}
if (TF == false) {
- if(test) {
- LOG.info("RETURN FALSE");
+ if(trace) {
+ LOG.trace("RETURN FALSE");
}
throw new AssertionFailedError();
}
@@ -157,14 +160,14 @@
assertEquivalent(expected, actual);
}
catch (AssertionFailedError e) {
- if(test) {
- LOG.info(expected.toString()
+ if(trace) {
+ LOG.trace(expected.toString()
+ ' ' + actual.toString() + " : not equals");
}
return;
}
- if(test) {
- LOG.info(expected.toString()
+ if(trace) {
+ LOG.trace(expected.toString()
+ ' ' + actual.toString() + " : equals");
}
throw new AssertionFailedError();
1
0
r146 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by fgilet@users.nuiton.org Feb. 28, 2010
by fgilet@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: fgilet
Date: 2010-02-28 17:50:11 +0100 (Sun, 28 Feb 2010)
New Revision: 146
Added:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Affichage d'une colonne suppl?\195?\169mentaire si besoin rajout?\195?\169e
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -161,11 +161,26 @@
DefaultTreeModel dtm = ((DefaultTreeModel) ui.getNavigation().getModel());
Set<String> tableNames = ohm.getTablesNames();
+
Iterator i = tableNames.iterator();
while(i.hasNext()){
+
+ //display the node table
String tableName = (String)i.next();
- dtm.insertNodeInto(new DefaultMutableTreeNode(tableName), root, root.getChildCount());
+ DefaultMutableTreeNode tableNameToInsert = new DefaultMutableTreeNode(tableName);
+ dtm.insertNodeInto(tableNameToInsert, root, root.getChildCount());
+
+ //display the node column
+ Set<String> columnNames = ohm.getColumnsNames(tableName);
+ Iterator i2 = columnNames.iterator();
+ while(i2.hasNext()){
+ String columnName = (String)i2.next();
+ DefaultMutableTreeNode columnNameToInsert = new DefaultMutableTreeNode(columnName);
+ dtm.insertNodeInto(columnNameToInsert, tableNameToInsert, tableNameToInsert.getChildCount());
+ }
+
+
}
ui.getNavigation().repaint();
Added: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java (rev 0)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ColumnModel.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -0,0 +1,84 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.ui.gui;
+
+import java.util.Iterator;
+import java.util.Set;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
+
+/**
+ * Model of a table content
+ * @author E045231P
+ */
+public class ColumnModel extends AbstractTableModel {
+
+
+ /**
+ * columnNames.
+ */
+ String[] titres;
+
+ /**
+ * data.
+ */
+ String[][] data;
+
+ /**
+ * Constructor.
+ */
+ public ColumnModel(TreeNode parent, DefaultMutableTreeNode node) {
+ String table = parent.toString();
+ String column = node.toString();
+ ApplicationEngine engine = ApplicationEngine.getInstance();
+ OurHashMap2 testHashmap2 = engine.getOurHashMap();
+ titres = new String[2];
+ titres[0]="Key";
+ titres[1]="Value";
+
+ //content
+ Set<String> keySetTable = testHashmap2.getKeys(table,column);
+ Iterator i = keySetTable.iterator();
+ data = new String[2][keySetTable.size()];
+ int j=0;
+ while(i.hasNext()){
+ String key = (String)i.next();
+ String value = testHashmap2.get(table, column, key);
+ data[0][j]=key;
+ data[1][j]=value;
+ j++;
+ }
+ }
+
+ @Override
+ public Object getValueAt(int rowIndex, int colIndex) {
+ return data[colIndex][rowIndex];
+ }
+
+ @Override
+ public int getColumnCount() {
+ return titres.length;
+ }
+
+ @Override
+ public int getRowCount() {
+ return data[0].length;
+ }
+
+ @Override
+ public String getColumnName(int col){
+ return titres[col];
+ }
+
+ @Override
+ public boolean isCellEditable(int row, int col) {
+ return false;
+ }
+
+
+}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -36,6 +36,20 @@
/* if nothing is selected */
if (node == null || node.isRoot()) {
return;
+ } else if (node.isLeaf()){
+ //we create a standard model of column
+ ColumnModel model = new ColumnModel(node.getParent(),node);
+ JTable jTable = new JTable(model);
+
+ JScrollPane scrollPane = new JScrollPane(jTable);
+ jTable.setFillsViewportHeight(true);
+
+ //we check attributes and values of the select table
+
+
+ //and display the result into the JPanel named 'tableContent'
+ ui.getTableContent().add(scrollPane);
+
} else {
//we create a standard model of table
TableModel model = new TableModel(node);
@@ -54,6 +68,8 @@
ui.getTableName().add(new JLabel("<html><b><u>"+node.toString()+"</b></u></html>"));
ui.getTableContent().repaint();
ui.getTableContent().revalidate();
+ ui.getTableName().repaint();
+ ui.getTableName().revalidate();
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 15:19:21 UTC (rev 145)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-28 16:50:11 UTC (rev 146)
@@ -39,99 +39,49 @@
OurHashMap2 hashmap = engine.getOurHashMap();
Set<String> columnsNames = hashmap.getColumnsNames(table);
- titles = new String[columnsNames.size()+1];
+ titles = new String[columnsNames.size()];
//content
- Set<String> tableKeys = hashmap.getKeys(table);
- Iterator<String> i = columnsNames.iterator();
- int colIndex = 0;
- int rowIndex = 0;
- System.out.println("set.size() : " + columnsNames.size()
- + " | keySet.size() : " + tableKeys.size());
- data = new String[columnsNames.size()+1][tableKeys.size()];
-
- // a column which shows keys.
- titles[colIndex++] = n_("keys");
-
+ Set<String> keySetTable = hashmap.getKeys(table);
+ Iterator i = columnsNames.iterator();
+ int colIndex=0;
+ int rowindex=0;
+ data = new String[columnsNames.size()][keySetTable.size()];
while(i.hasNext()){
- String titreTemp = i.next();
+ String titreTemp = (String)i.next();
titles[colIndex] = titreTemp;
- Set<String> columnKeys =
- hashmap.getKeys(table, titles[colIndex]);
+ Set<String> columnKeys = hashmap.getKeys(table, titles[colIndex]);
Iterator<String> i2 = columnKeys.iterator();
while(i2.hasNext()){
- String key = i2.next();
- System.out.println("table = " + table);
- System.out.println("titreTemp = " + titreTemp);
- String str = hashmap.get(table, titreTemp, key);
- //data[j][k]=str;
- // the key
- this.setValueAt(rowIndex, 0, key);
- this.setValueAt(rowIndex, colIndex, str);
- System.out.println("data[" + colIndex + "][" + rowIndex + "] = "
- + data[colIndex][rowIndex]);
- rowIndex++;
+ String str = hashmap.get(table,titreTemp,(String)i2.next());
+ data[colIndex][rowindex]=str;
+ rowindex++;
}
colIndex++;
}
}
- /**
- * put data into the table.
- * @param rowIndex the rox index
- * @param colIndex the column index
- * @param value to put in the table.
- */
- public void setValueAt(int rowIndex, int colIndex, String value) {
- data[colIndex][rowIndex] = value;
- }
-
- /**
- * get data from the table.
- * @param rowIndex the rox index
- * @param colIndex the column index
- */
@Override
public Object getValueAt(int rowIndex, int colIndex) {
return data[colIndex][rowIndex];
}
- /**
- * count the number of column.
- * @return the column count
- */
@Override
public int getColumnCount() {
return titles.length;
}
- /**
- * count the number of line.
- * @return the line count
- */
@Override
public int getRowCount() {
return data[0].length;
}
- /**
- * count the number of column.
- * @param col the column number
- * @return the name of the column col
- */
@Override
public String getColumnName(int col){
return titles[col];
}
-
- /**
- * Check if the cell is editable.
- * @param row the line number
- * @param col the column number
- * @return false
- */
@Override
public boolean isCellEditable(int row, int col) {
return false;
1
0
r145 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 16:19:21 +0100 (Sun, 28 Feb 2010)
New Revision: 145
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
Log:
Prise en compte des attributs dans la comparaison de deux elements.
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 13:30:46 UTC (rev 144)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 15:19:21 UTC (rev 145)
@@ -23,7 +23,7 @@
*/
private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
- private static boolean test = true;
+ private static boolean test = false;
/**
* Test if to Element are equivalent.
@@ -34,14 +34,9 @@
public static void assertEquivalent(Element expected, Element actual)
throws AssertionFailedError {
-// String expectedContent = expected.getContent();
-// String actualContent = actual.getContent();
-
if(test) {
System.out.println("---------------------------------------------");
}
-// System.out.println(expected.getContent());
-// System.out.println(actual.getContent());
String expectedElementName = expected.getName();
String actualElementName = actual.getName();
@@ -74,21 +69,28 @@
}
} else {
// case with only many attribute.
- // TODO -> we have only one attribute for instance.
+ for(Attribute expectedAttribute : expectedAttributes) {
+ String attributeName = expectedAttribute.getName();
+ String expectedAttributeValue =
+ expected.getAttributeValue(attributeName);
+ String actualAttributeValue =
+ actual.getAttributeValue(attributeName);
+ if (!expectedAttributeValue.equals(actualAttributeValue)) {
+ throw new AssertionFailedError();
+ }
+ }
}
if(test) {
LOG.info("Attribues"
+ '\n' + expectedAttributes
- + '\n' + actualAttributes);
-
-// System.out.println("Children");
-// System.out.println(expectedChildren);
-// System.out.println(actualChildren);
-
-// System.out.println("Value");
-// System.out.println(expectedValue);
-// System.out.println(actualValue);
+ + '\n' + actualAttributes
+ + '\n' + "Children"
+ + '\n' + expectedChildren
+ + '\n' + actualChildren
+ + '\n' + "Value"
+ + '\n' + expectedValue
+ + '\n' + actualValue);
}
if (expectedChildren.size() != actualChildren.size()) {
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 13:30:46 UTC (rev 144)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 15:19:21 UTC (rev 145)
@@ -37,6 +37,100 @@
* test if two simple elements with attributes are equivalents or not.
*/
public void testSimpleElementWithAttributes() {
+ Element a;
+ Element b;
+ Element c;
+ Element d;
+
+// assertEquivalent(a, b);
+// assertEquivalent(c, d);
+// assertNotEquivalent(a, c);
+// assertNotEquivalent(b, c);
+// assertNotEquivalent(a, d);
+// assertNotEquivalent(b, d);
+
+ /**
+ * We put attribute and verify they are not same.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+ c = new Element("test2");
+ d = new Element("test2");
+
+ a.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(c, d);
+ }
+
+ /**
+ * we put same attributes in different order.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+ c = new Element("test2");
+ d = new Element("test2");
+
+ a.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(a, b);
+ a.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+ b.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(c, d);
+ c.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(c, d);
+ d.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(c, d);
+ }
+
+ /**
+ * we put different attributes.
+ */
+ {
+ a = new Element("test");
+ b = new Element("test");
+
+ a.setAttribute(new Attribute("attrib4", "attrib4"));
+ a.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib6", "attrib6"));
+ b.setAttribute(new Attribute("attrib7", "attrib7"));
+ assertNotEquivalent(a, b);
+
+
+ a.setAttribute(new Attribute("attrib7", "attrib7"));
+ a.setAttribute(new Attribute("attrib6", "attrib6"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib5", "attrib5"));
+ b.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertEquivalent(a, b);
+ }
+ }
+
+ /**
+ * test if two simple elements with values are equivalent or not.
+ */
+ public void testSimpleElementWithValue() {
Element a = new Element("test");
Element b = new Element("test");
Element c = new Element("test2");
@@ -49,43 +143,84 @@
assertNotEquivalent(a, d);
assertNotEquivalent(b, d);
- /**
- * We put attribute and verify they are not same.
- */
-
- a.setAttribute(new Attribute("attrib1", "attrib1"));
+ a.setText("test");
assertNotEquivalent(a, b);
-
- b.setAttribute(new Attribute("attrib1", "attrib1"));
+ b.setText("test");
assertEquivalent(a, b);
-
- c.setAttribute(new Attribute("attrib2", "attrib2"));
+ c.setText("test");
assertNotEquivalent(c, d);
-
- d.setAttribute(new Attribute("attrib2", "attrib2"));
+ d.setText("test");
assertEquivalent(c, d);
/**
- * we put same attributes in different order.
+ * We test that with same value, they are not equivalents.
*/
- a.setAttribute(new Attribute("attrib2", "attrib2"));
- assertNotEquivalent(a, b);
- a.setAttribute(new Attribute("attrib3", "attrib3"));
- assertNotEquivalent(a, b);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ assertNotEquivalent(a, d);
+ assertNotEquivalent(b, d);
+ }
- b.setAttribute(new Attribute("attrib3", "attrib3"));
- assertNotEquivalent(a, b);
- b.setAttribute(new Attribute("attrib2", "attrib2"));
- assertEquivalent(a, b);
+ /**
+ * test if two simple elements with values are equivalent or not.
+ */
+ public void testSimpleElementWithSimpleChildren() {
+ final Element childA = new Element("childTest1");
+ final Element childB = new Element("childTest2");
+ assertNotEquivalent(childA,childB);
- c.setAttribute(new Attribute("attrib4", "attrib4"));
- assertNotEquivalent(c, d);
- c.setAttribute(new Attribute("attrib5", "attrib5"));
- assertNotEquivalent(c, d);
+ {
+ /**
+ * test with children in same order.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
- d.setAttribute(new Attribute("attrib5", "attrib5"));
- assertNotEquivalent(c, d);
- d.setAttribute(new Attribute("attrib4", "attrib4"));
- assertEquivalent(c, d);
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childB.clone());
+ assertEquivalent(a, b);
+ }
+ {
+ /**
+ * test with children in different order.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ a.addContent((Element) childB.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+ }
+ {
+ /**
+ * test with one chidren in one Element
+ * and with two same children in the second element.
+ */
+ Element a = new Element("test");
+ Element b = new Element("test");
+ assertEquivalent(a, b);
+
+ a.addContent((Element) childA.clone());
+ a.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+
+ b.addContent((Element) childA.clone());
+ assertNotEquivalent(a, b);
+ b.addContent((Element) childA.clone());
+ assertEquivalent(a, b);
+ }
}
}
1
0
r144 - in trunk/msm-fromtoXML/src: main test/java/org/nuiton/mapstoragemanager/plugins test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 14:30:46 +0100 (Sun, 28 Feb 2010)
New Revision: 144
Added:
trunk/msm-fromtoXML/src/main/resources/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Log:
Transformation de la m?\195?\169thode de test d'?\195?\169quivalent d'Element jdom en assertEquivalent.
D?\195?\169but de test de cette m?\195?\169thode assertEquivalent.
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElement.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -0,0 +1,170 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins;
+
+import java.util.List;
+import junit.framework.AssertionFailedError;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Attribute;
+import org.jdom.Element;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class AssertJdomElement {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(AssertJdomElement.class);
+
+ private static boolean test = true;
+
+ /**
+ * Test if to Element are equivalent.
+ * @param expected expected element.
+ * @param actual actual element.
+ * @return true if expected and actual are equivalents.
+ */
+ public static void assertEquivalent(Element expected, Element actual)
+ throws AssertionFailedError {
+
+// String expectedContent = expected.getContent();
+// String actualContent = actual.getContent();
+
+ if(test) {
+ System.out.println("---------------------------------------------");
+ }
+// System.out.println(expected.getContent());
+// System.out.println(actual.getContent());
+
+ String expectedElementName = expected.getName();
+ String actualElementName = actual.getName();
+
+ if(!expectedElementName.equals(actualElementName)) {
+ throw new AssertionFailedError();
+ }
+
+ List<Attribute> expectedAttributes = expected.getAttributes();
+ List<Attribute> actualAttributes = actual.getAttributes();
+
+ List<Element> expectedChildren = expected.getChildren();
+ List<Element> actualChildren = actual.getChildren();
+
+ String expectedValue = expected.getValue();
+ String actualValue = actual.getValue();
+
+
+ // we compare attributes.
+ if (expectedAttributes.size() != actualAttributes.size()) {
+ throw new AssertionFailedError();
+// return;
+ } else if (expectedAttributes.size() == 1) {
+ // case with only one attribute.
+ String expectedAttribute = expectedAttributes.toString();
+ String actualAttribute = actualAttributes.toString();
+ if (! expectedAttribute.equals(actualAttribute)) {
+ throw new AssertionFailedError();
+// return;
+ }
+ } else {
+ // case with only many attribute.
+ // TODO -> we have only one attribute for instance.
+ }
+
+ if(test) {
+ LOG.info("Attribues"
+ + '\n' + expectedAttributes
+ + '\n' + actualAttributes);
+
+// System.out.println("Children");
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+// System.out.println("Value");
+// System.out.println(expectedValue);
+// System.out.println(actualValue);
+ }
+
+ if (expectedChildren.size() != actualChildren.size()) {
+ throw new AssertionFailedError();
+// return;
+ } else if (expectedChildren.isEmpty()) {
+ if(test) {
+ LOG.info(expectedValue + '\n' + actualValue);
+ }
+ if (!expected.getValue().equals(actual.getValue())) {
+ throw new AssertionFailedError();
+
+ }
+ return;
+ }
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+ boolean TF;
+ // same elements.
+ for (Element expectedChild : expectedChildren) {
+ TF = false;
+ for (Element actualChild : actualChildren) {
+ if(actualChild.getChildren().size() ==
+ expectedChild.getChildren().size()) {
+ try {
+ assertEquivalent(expectedChild, actualChild);
+ TF = true;
+ }
+ catch (AssertionFailedError e) {
+ LOG.error(e);
+ }
+ /*if (testEquals(expectedChild,actualChild)) {
+// actualChildren.remove(actualChild);
+ TF = true;
+ if(trace) {
+ System.out.println("EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
+ } else {
+ if(trace) {
+ System.out.println("NOT EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
+ }*/
+ }
+ }
+ if (TF == false) {
+ if(test) {
+ LOG.info("RETURN FALSE");
+ }
+ throw new AssertionFailedError();
+ }
+ }
+
+ return;
+ }
+
+ public static void assertNotEquivalent(Element expected, Element actual)
+ throws AssertionFailedError {
+ try{
+ assertEquivalent(expected, actual);
+ }
+ catch (AssertionFailedError e) {
+ if(test) {
+ LOG.info(expected.toString()
+ + ' ' + actual.toString() + " : not equals");
+ }
+ return;
+ }
+ if(test) {
+ LOG.info(expected.toString()
+ + ' ' + actual.toString() + " : equals");
+ }
+ throw new AssertionFailedError();
+ }
+}
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/AssertJdomElementTest.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -0,0 +1,91 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins;
+
+import junit.framework.TestCase;
+import org.jdom.Attribute;
+import org.jdom.Element;
+import static
+ org.nuiton.mapstoragemanager.plugins.AssertJdomElement.assertEquivalent;
+import static
+ org.nuiton.mapstoragemanager.plugins.AssertJdomElement.assertNotEquivalent;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class AssertJdomElementTest extends TestCase {
+
+ /**
+ * test if two simple elements with same name are equivalents.
+ * test if two simple elements with different name are equivalents.
+ */
+ public void testSimpleElement() {
+ Element a = new Element("test");
+ Element b = new Element("test");
+ Element c = new Element("test2");
+
+ assertEquivalent(a, b);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ }
+
+ /**
+ * test if two simple elements with attributes are equivalents or not.
+ */
+ public void testSimpleElementWithAttributes() {
+ Element a = new Element("test");
+ Element b = new Element("test");
+ Element c = new Element("test2");
+ Element d = new Element("test2");
+
+ assertEquivalent(a, b);
+ assertEquivalent(c, d);
+ assertNotEquivalent(a, c);
+ assertNotEquivalent(b, c);
+ assertNotEquivalent(a, d);
+ assertNotEquivalent(b, d);
+
+ /**
+ * We put attribute and verify they are not same.
+ */
+
+ a.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib1", "attrib1"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(c, d);
+
+ /**
+ * we put same attributes in different order.
+ */
+ a.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertNotEquivalent(a, b);
+ a.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+
+ b.setAttribute(new Attribute("attrib3", "attrib3"));
+ assertNotEquivalent(a, b);
+ b.setAttribute(new Attribute("attrib2", "attrib2"));
+ assertEquivalent(a, b);
+
+ c.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertNotEquivalent(c, d);
+ c.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(c, d);
+
+ d.setAttribute(new Attribute("attrib5", "attrib5"));
+ assertNotEquivalent(c, d);
+ d.setAttribute(new Attribute("attrib4", "attrib4"));
+ assertEquivalent(c, d);
+ }
+}
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 11:06:53 UTC (rev 143)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 13:30:46 UTC (rev 144)
@@ -5,7 +5,7 @@
package org.nuiton.mapstoragemanager.plugins.exporter;
-import java.io.IOException;
+//import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
import junit.framework.TestCase;
@@ -14,10 +14,11 @@
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
+//import org.jdom.output.Format;
+//import org.jdom.output.XMLOutputter;
import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+import org.nuiton.mapstoragemanager.plugins.AssertJdomElement;
import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
/**
@@ -46,7 +47,8 @@
Element actualRoot = actual.getRootElement();
Element expectedRoot = expected.getRootElement();
- assertTrue(testEquals(expectedRoot, actualRoot));
+// assertTrue(testEquals(expectedRoot, actualRoot));
+ AssertJdomElement.assertEquivalent(expectedRoot, actualRoot);
}
/**
@@ -248,7 +250,7 @@
* @param actual actual element.
* @return true if expected and actual are equivalents.
*/
- public static boolean testEquals(Element expected, Element actual) {
+ /*public static boolean testEquals(Element expected, Element actual) {
boolean trace = true;
// String expectedContent = expected.getContent();
@@ -260,6 +262,13 @@
// System.out.println(expected.getContent());
// System.out.println(actual.getContent());
+ String expectedElementName = expected.getName();
+ String actualElementName = actual.getName();
+
+ if(!expectedElementName.equals(actualElementName)) {
+ return false;
+ }
+
List<Attribute> expectedAttributes = expected.getAttributes();
List<Attribute> actualAttributes = actual.getAttributes();
@@ -344,7 +353,7 @@
}
return true;
- }
+ }*/
public static void main(String[] args) {
NewBigTable nbt = new BigHashMap();
1
0
r143 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 28, 2010
by dlanglais@users.nuiton.org Feb. 28, 2010
Feb. 28, 2010
Author: dlanglais
Date: 2010-02-28 12:06:53 +0100 (Sun, 28 Feb 2010)
New Revision: 143
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Log:
Avancement fonction de comparaison d'?\195?\169lement jdom.
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 11:00:34 UTC (rev 142)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-28 11:06:53 UTC (rev 143)
@@ -31,14 +31,32 @@
*/
private static final Log LOG = LogFactory.getLog(ToXMLTest.class);
+
+
+ private static Document actual;
+ private static Document expected;
+
/**
* Test to export a bigTable database in a xml format.
*/
public void testToXML() {
+ // init actual et expected.
+ createXMLDocument();
- Document actual = null;
- Document expected = new Document();
+ Element actualRoot = actual.getRootElement();
+ Element expectedRoot = expected.getRootElement();
+ assertTrue(testEquals(expectedRoot, actualRoot));
+ }
+
+ /**
+ * Create a bigTable database and a XMLDocument representing the database.
+ */
+ public void createXMLDocument() {
+
+ actual = null;
+ expected = new Document();
+
/********************************
* Creation of the database. *
********************************/
@@ -142,51 +160,51 @@
value5.setText("content5");
cell5.addContent(value5);
-// nbt.put("table2", "column3", "6", "content6");
-// Element cell6 = new Element("cell");
-// Attribute cell6key = new Attribute("key", "6");
-// cell6.setAttribute(cell6key);
-// column3.addContent(cell6);
-// Element value6 = new Element("value");
-// value6.setText("content6");
-// cell6.addContent(value6);
-//
-// nbt.put("table2", "column4", "7", "content7");
-// Element cell7 = new Element("cell");
-// Attribute cell7key = new Attribute("key", "7");
-// cell7.setAttribute(cell7key);
-// column4.addContent(cell7);
-// Element value7 = new Element("value");
-// value7.setText("content7");
-// cell7.addContent(value7);
-//
-// nbt.put("table2", "column4", "8", "content8");
-// Element cell8 = new Element("cell");
-// Attribute cell8key = new Attribute("key", "8");
-// cell8.setAttribute(cell8key);
-// column4.addContent(cell8);
-// Element value8 = new Element("value");
-// value8.setText("content8");
-// cell8.addContent(value8);
-//
-// nbt.put("table2", "column5", "9", "content9");
-// Element cell9 = new Element("cell");
-// Attribute cell9key = new Attribute("key", "9");
-// cell9.setAttribute(cell9key);
-// column5.addContent(cell9);
-// Element value9 = new Element("value");
-// value9.setText("content9");
-// cell9.addContent(value9);
-//
-// nbt.put("table2", "column5", "10", "content10");
-// Element cell10 = new Element("cell");
-// Attribute cell10key = new Attribute("key", "10");
-// cell10.setAttribute(cell10key);
-// column5.addContent(cell10);
-// Element value10 = new Element("value");
-// value10.setText("content10");
-// cell10.addContent(value10);
+ nbt.put("table2", "column3", "6", "content6");
+ Element cell6 = new Element("cell");
+ Attribute cell6key = new Attribute("key", "6");
+ cell6.setAttribute(cell6key);
+ column3.addContent(cell6);
+ Element value6 = new Element("value");
+ value6.setText("content6");
+ cell6.addContent(value6);
+ nbt.put("table2", "column4", "7", "content7");
+ Element cell7 = new Element("cell");
+ Attribute cell7key = new Attribute("key", "7");
+ cell7.setAttribute(cell7key);
+ column4.addContent(cell7);
+ Element value7 = new Element("value");
+ value7.setText("content7");
+ cell7.addContent(value7);
+
+ nbt.put("table2", "column4", "8", "content8");
+ Element cell8 = new Element("cell");
+ Attribute cell8key = new Attribute("key", "8");
+ cell8.setAttribute(cell8key);
+ column4.addContent(cell8);
+ Element value8 = new Element("value");
+ value8.setText("content8");
+ cell8.addContent(value8);
+
+ nbt.put("table2", "column5", "9", "content9");
+ Element cell9 = new Element("cell");
+ Attribute cell9key = new Attribute("key", "9");
+ cell9.setAttribute(cell9key);
+ column5.addContent(cell9);
+ Element value9 = new Element("value");
+ value9.setText("content9");
+ cell9.addContent(value9);
+
+ nbt.put("table2", "column5", "10", "content10");
+ Element cell10 = new Element("cell");
+ Attribute cell10key = new Attribute("key", "10");
+ cell10.setAttribute(cell10key);
+ column5.addContent(cell10);
+ Element value10 = new Element("value");
+ value10.setText("content10");
+ cell10.addContent(value10);
+
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
@@ -208,13 +226,13 @@
LOG.error(ex, ex);
}
- try {
- XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
- output.output(expected, System.out);
- output.output(actual, System.out);
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
+// try {
+// XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+// output.output(expected, System.out);
+// output.output(actual, System.out);
+// } catch (IOException ex) {
+// LOG.error(ex, ex);
+// }
// assertEquals(expected,actual);
// testEquals(expected.getRootElement(),actual.getRootElement());
@@ -224,40 +242,71 @@
// assertEquals(expected, actual);
}
+ /**
+ * Test if to Element are equal.
+ * @param expected expected element.
+ * @param actual actual element.
+ * @return true if expected and actual are equivalents.
+ */
public static boolean testEquals(Element expected, Element actual) {
- System.out.println(expected.getContent());
- System.out.println(actual.getContent());
+ boolean trace = true;
+// String expectedContent = expected.getContent();
+// String actualContent = actual.getContent();
- // same attribute list.
-// if (!expected.getAttributes().equals(actual.getAttributes())) {
-// return false;
-// }
+ if(trace) {
+ System.out.println("---------------------------------------------");
+ }
+// System.out.println(expected.getContent());
+// System.out.println(actual.getContent());
-// if (!expected.getAttributes().equals(actual.getAttributes())) {
-// return false;
-// }
+ List<Attribute> expectedAttributes = expected.getAttributes();
+ List<Attribute> actualAttributes = actual.getAttributes();
-// System.out.println(expected.getAttributes());
-// System.out.println(actual.getAttributes());
- // same attributes values.
-// for (Attribute attribute : (List<Attribute>) expected.getAttributes()) {
-// String attrName = attribute.getName();
-// String expectedAttrValue = expected.getAttributeValue(attrName);
-// String actualAttrValue = actual.getAttributeValue(attrName);
-// if (!expectedAttrValue.equals(actualAttrValue)) {
-// return false;
-// }
-// }
+ List<Element> expectedChildren = expected.getChildren();
+ List<Element> actualChildren = actual.getChildren();
+ String expectedValue = expected.getValue();
+ String actualValue = actual.getValue();
- List<Element> expectedChildren = (List<Element>) expected.getChildren();
- List<Element> actualChildren = (List<Element>) actual.getChildren();
+ // we compare attributes.
+ if (expectedAttributes.size() != actualAttributes.size()) {
+ return false;
+ } else if (expectedAttributes.size() == 1) {
+ // case with only one attribute.
+ String expectedAttribute = expectedAttributes.toString();
+ String actualAttribute = actualAttributes.toString();
+ if (! expectedAttribute.equals(actualAttribute)) {
+ return false;
+ }
+ } else {
+ // case with only many attribute.
+ // TODO -> we have only one attribute for instance.
+ }
+
+ if(trace) {
+ System.out.println("Attribues");
+ System.out.println(expectedAttributes);
+ System.out.println(actualAttributes);
+
+// System.out.println("Children");
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+// System.out.println("Value");
+// System.out.println(expectedValue);
+// System.out.println(actualValue);
+ }
+
if (expectedChildren.size() != actualChildren.size()) {
return false;
} else if (expectedChildren.isEmpty()) {
- return expected.getContent().equals(actual.getContent());
+ if(trace) {
+ System.out.println(expectedValue);
+ System.out.println(actualValue);
+ }
+ return expected.getValue().equals(actual.getValue());
}
// System.out.println(expectedChildren);
// System.out.println(actualChildren);
@@ -272,15 +321,26 @@
if (testEquals(expectedChild,actualChild)) {
// actualChildren.remove(actualChild);
TF = true;
+ if(trace) {
+ System.out.println("EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
} else {
- // System.out.println(expectedChild.getChildren());
- // System.out.println(actualChild.getChildren());
+ if(trace) {
+ System.out.println("NOT EQUIVALENT");
+ System.out.println(expectedChild.getValue());
+ System.out.println(actualChild.getValue());
+ }
}
}
}
-// if (TF == false) {
-// return false;
-// }
+ if (TF == false) {
+ if(trace) {
+ System.out.println("RETURN FALSE");
+ }
+ return false;
+ }
}
return true;
@@ -312,8 +372,5 @@
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
-
- Document a = new Document();
- Document b = new Document();
}
}
1
0
Author: afages
Date: 2010-02-28 12:00:34 +0100 (Sun, 28 Feb 2010)
New Revision: 142
Added:
trunk/src/site/reports/planningMSM.xls
Modified:
trunk/src/site/reports/CompteRendu_18-02-2010.rst
Log:
Ajout d'un planning pr?\195?\169visionnel dans reports/
Modified: trunk/src/site/reports/CompteRendu_18-02-2010.rst
===================================================================
--- trunk/src/site/reports/CompteRendu_18-02-2010.rst 2010-02-27 21:15:05 UTC (rev 141)
+++ trunk/src/site/reports/CompteRendu_18-02-2010.rst 2010-02-28 11:00:34 UTC (rev 142)
@@ -30,6 +30,7 @@
- Amélioration graphique sur tous les points (arbre, menu, boutons,...).
- Réalisation des "Cockburn" des cas d'utilisations.
- Test sous shell HBase sur le retour des méthodes et faire l'analogie avec l'API.
+- Planning de gestion de projet !
RAF (Reste à faire)
@@ -38,4 +39,5 @@
- Diagramme de classe.
- Décrire les actions du diagramme du cas d'utilisation.
- Schéma général de l'application (architecture, action entre les entités, dépendances,...).
-- Implémentation plus complexe de l'interface graphique.
\ No newline at end of file
+- Implémentation plus complexe de l'interface graphique.
+- Planning
\ No newline at end of file
Added: trunk/src/site/reports/planningMSM.xls
===================================================================
(Binary files differ)
Property changes on: trunk/src/site/reports/planningMSM.xls
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
r141 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 22:15:05 +0100 (Sat, 27 Feb 2010)
New Revision: 141
Added:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
Removed:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
Log:
Commencement d'une fonction de comparaison de document jdom...
Deleted: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:31:53 UTC (rev 140)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 21:15:05 UTC (rev 141)
@@ -1,251 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.nuiton.mapstoragemanager.plugins.exporter;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import junit.framework.TestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdom.Attribute;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-import org.nuiton.mapstoragemanager.plugins.Exporter;
-import org.nuiton.mapstoragemanager.plugins.NewBigTable;
-import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
-
-/**
- *
- * @author Dorian Langlais
- */
-public class ExporterTest extends TestCase {
-
- /**
- * Logger.
- */
- private static final Log LOG = LogFactory.getLog(ExporterTest.class);
-// private static final Log LOGXML = LogFactory.getLog(ToXML.class);
- public void testToXML() {
-
- Document actual = null;
- Document expected = new Document();
-
- /********************************
- * Creation of the database. *
- ********************************/
- NewBigTable nbt = new BigHashMap();
- Element database = new Element("database");
- expected.addContent(database);
-
- /********************************
- * Creation of the tables. *
- ********************************/
- nbt.createTable("table1");
- Element table1 = new Element("table");
- Attribute table1name = new Attribute("tableName", "table1");
- table1.setAttribute(table1name);
- database.addContent(table1);
- nbt.createTable("table2");
- Element table2 = new Element("table");
- Attribute table2name = new Attribute("tableName", "table2");
- table2.setAttribute(table2name);
- database.addContent(table2);
-
- /********************************
- * Creation of the columns. *
- ********************************/
- nbt.createColumn("table1", "column1");
- Element column1 = new Element("column");
- Attribute column1name = new Attribute("columnName", "column1");
- column1.setAttribute(column1name);
- table1.addContent(column1);
-
- nbt.createColumn("table1", "column2");
- Element column2 = new Element("column");
- Attribute column2name = new Attribute("columnName", "column2");
- column2.setAttribute(column2name);
- table1.addContent(column2);
-
- nbt.createColumn("table2", "column3");
- Element column3 = new Element("column");
- Attribute column3name = new Attribute("columnName", "column3");
- column3.setAttribute(column3name);
- table2.addContent(column3);
-
- nbt.createColumn("table2", "column4");
- Element column4 = new Element("column");
- Attribute column4name = new Attribute("columnName", "column4");
- column4.setAttribute(column4name);
- table2.addContent(column4);
-
- nbt.createColumn("table2", "column5");
- Element column5 = new Element("column");
- Attribute column5name = new Attribute("columnName", "column5");
- column5.setAttribute(column5name);
- table2.addContent(column5);
-
-
- /********************************
- * Put elements in the columns. *
- ********************************/
- nbt.put("table1", "column1", "1", "content1");
- Element cell1 = new Element("cell");
- Attribute cell1key = new Attribute("key", "1");
- cell1.setAttribute(cell1key);
- column1.addContent(cell1);
- Element value1 = new Element("value");
- value1.setText("content1");
- cell1.addContent(value1);
-
- nbt.put("table1", "column1", "2", "content2");
- Element cell2 = new Element("cell");
- Attribute cell2key = new Attribute("key", "2");
- cell2.setAttribute(cell2key);
- column1.addContent(cell2);
- Element value2 = new Element("value");
- value2.setText("content2");
- cell2.addContent(value2);
-
- nbt.put("table1", "column2", "3", "content3");
- Element cell3 = new Element("cell");
- Attribute cell3key = new Attribute("key", "3");
- cell3.setAttribute(cell3key);
- column2.addContent(cell3);
- Element value3 = new Element("value");
- value3.setText("content3");
- cell3.addContent(value3);
-
- nbt.put("table1", "column2", "4", "content4");
- Element cell4 = new Element("cell");
- Attribute cell4key = new Attribute("key", "4");
- cell4.setAttribute(cell4key);
- column2.addContent(cell4);
- Element value4 = new Element("value");
- value4.setText("content4");
- cell4.addContent(value4);
-
- nbt.put("table2", "column3", "5", "content5");
- Element cell5 = new Element("cell");
- Attribute cell5key = new Attribute("key", "5");
- cell5.setAttribute(cell5key);
- column3.addContent(cell5);
- Element value5 = new Element("value");
- value5.setText("content5");
- cell5.addContent(value5);
-
- nbt.put("table2", "column3", "6", "content6");
- Element cell6 = new Element("cell");
- Attribute cell6key = new Attribute("key", "6");
- cell6.setAttribute(cell6key);
- column3.addContent(cell6);
- Element value6 = new Element("value");
- value6.setText("content6");
- cell6.addContent(value6);
-
- nbt.put("table2", "column4", "7", "content7");
- Element cell7 = new Element("cell");
- Attribute cell7key = new Attribute("key", "7");
- cell7.setAttribute(cell7key);
- column4.addContent(cell7);
- Element value7 = new Element("value");
- value7.setText("content7");
- cell7.addContent(value7);
-
- nbt.put("table2", "column4", "8", "content8");
- Element cell8 = new Element("cell");
- Attribute cell8key = new Attribute("key", "8");
- cell8.setAttribute(cell8key);
- column4.addContent(cell8);
- Element value8 = new Element("value");
- value8.setText("content8");
- cell8.addContent(value8);
-
- nbt.put("table2", "column5", "9", "content9");
- Element cell9 = new Element("cell");
- Attribute cell9key = new Attribute("key", "9");
- cell9.setAttribute(cell9key);
- column5.addContent(cell9);
- Element value9 = new Element("value");
- value9.setText("content9");
- cell9.addContent(value9);
-
- nbt.put("table2", "column5", "10", "content10");
- Element cell10 = new Element("cell");
- Attribute cell10key = new Attribute("key", "10");
- cell10.setAttribute(cell10key);
- column5.addContent(cell10);
- Element value10 = new Element("value");
- value10.setText("content10");
- cell10.addContent(value10);
-
- Exporter exporter = new ToXML();
- exporter.exportTo(nbt, null);
-
-
-// expected.toString();
-
- Field fdocument;
- try {
- fdocument = exporter.getClass().getDeclaredField("document");
- fdocument.setAccessible(true);
- actual = (Document) fdocument.get(exporter);
- } catch (IllegalArgumentException ex) {
- LOG.error(ex, ex);
- } catch (IllegalAccessException ex) {
- LOG.error(ex, ex);
- } catch (NoSuchFieldException ex) {
- LOG.error(ex, ex);
- } catch (SecurityException ex) {
- LOG.error(ex, ex);
- }
-
- try {
- XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
- output.output(expected, System.out);
- output.output(actual, System.out);
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
-
-// System.out.println(expected);
-// System.out.println(actual);
-// assertEquals(expected.toString(),actual.toString());
-// assertEquals(expected, actual);
- }
-
- public static void main(String[] args) {
- NewBigTable nbt = new BigHashMap();
- nbt.createTable("table1");
- nbt.createTable("table2");
-
- nbt.createColumn("table1", "column1");
- nbt.createColumn("table1", "column2");
-
- nbt.createColumn("table2", "column3");
- nbt.createColumn("table2", "column4");
- nbt.createColumn("table2", "column5");
-
- nbt.put("table1", "column1", "1", "content1");
- nbt.put("table1", "column1", "2", "content2");
- nbt.put("table1", "column2", "3", "content3");
- nbt.put("table1", "column2", "4", "content4");
-
- nbt.put("table2", "column3", "5", "content5");
- nbt.put("table2", "column3", "6", "content6");
- nbt.put("table2", "column4", "7", "content7");
- nbt.put("table2", "column4", "8", "content8");
- nbt.put("table2", "column5", "9", "content9");
- nbt.put("table2", "column5", "10", "content10");
-
- Exporter exporter = new ToXML();
- exporter.exportTo(nbt, null);
-
- Document a = new Document();
- Document b = new Document();
- }
-}
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLTest.java 2010-02-27 21:15:05 UTC (rev 141)
@@ -0,0 +1,319 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins.exporter;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.List;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Attribute;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class ToXMLTest extends TestCase {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ToXMLTest.class);
+
+ /**
+ * Test to export a bigTable database in a xml format.
+ */
+ public void testToXML() {
+
+ Document actual = null;
+ Document expected = new Document();
+
+ /********************************
+ * Creation of the database. *
+ ********************************/
+ NewBigTable nbt = new BigHashMap();
+ Element database = new Element("database");
+ expected.addContent(database);
+
+ /********************************
+ * Creation of the tables. *
+ ********************************/
+ nbt.createTable("table1");
+ Element table1 = new Element("table");
+ Attribute table1name = new Attribute("tableName", "table1");
+ table1.setAttribute(table1name);
+ database.addContent(table1);
+ nbt.createTable("table2");
+ Element table2 = new Element("table");
+ Attribute table2name = new Attribute("tableName", "table2");
+ table2.setAttribute(table2name);
+ database.addContent(table2);
+
+ /********************************
+ * Creation of the columns. *
+ ********************************/
+ nbt.createColumn("table1", "column1");
+ Element column1 = new Element("column");
+ Attribute column1name = new Attribute("columnName", "column1");
+ column1.setAttribute(column1name);
+ table1.addContent(column1);
+
+ nbt.createColumn("table1", "column2");
+ Element column2 = new Element("column");
+ Attribute column2name = new Attribute("columnName", "column2");
+ column2.setAttribute(column2name);
+ table1.addContent(column2);
+
+ nbt.createColumn("table2", "column3");
+ Element column3 = new Element("column");
+ Attribute column3name = new Attribute("columnName", "column3");
+ column3.setAttribute(column3name);
+ table2.addContent(column3);
+
+ nbt.createColumn("table2", "column4");
+ Element column4 = new Element("column");
+ Attribute column4name = new Attribute("columnName", "column4");
+ column4.setAttribute(column4name);
+ table2.addContent(column4);
+
+ nbt.createColumn("table2", "column5");
+ Element column5 = new Element("column");
+ Attribute column5name = new Attribute("columnName", "column5");
+ column5.setAttribute(column5name);
+ table2.addContent(column5);
+
+
+ /********************************
+ * Put elements in the columns. *
+ ********************************/
+ nbt.put("table1", "column1", "1", "content1");
+ Element cell1 = new Element("cell");
+ Attribute cell1key = new Attribute("key", "1");
+ cell1.setAttribute(cell1key);
+ column1.addContent(cell1);
+ Element value1 = new Element("value");
+ value1.setText("content1");
+ cell1.addContent(value1);
+
+ nbt.put("table1", "column1", "2", "content2");
+ Element cell2 = new Element("cell");
+ Attribute cell2key = new Attribute("key", "2");
+ cell2.setAttribute(cell2key);
+ column1.addContent(cell2);
+ Element value2 = new Element("value");
+ value2.setText("content2");
+ cell2.addContent(value2);
+
+ nbt.put("table1", "column2", "3", "content3");
+ Element cell3 = new Element("cell");
+ Attribute cell3key = new Attribute("key", "3");
+ cell3.setAttribute(cell3key);
+ column2.addContent(cell3);
+ Element value3 = new Element("value");
+ value3.setText("content3");
+ cell3.addContent(value3);
+
+ nbt.put("table1", "column2", "4", "content4");
+ Element cell4 = new Element("cell");
+ Attribute cell4key = new Attribute("key", "4");
+ cell4.setAttribute(cell4key);
+ column2.addContent(cell4);
+ Element value4 = new Element("value");
+ value4.setText("content4");
+ cell4.addContent(value4);
+
+ nbt.put("table2", "column3", "5", "content5");
+ Element cell5 = new Element("cell");
+ Attribute cell5key = new Attribute("key", "5");
+ cell5.setAttribute(cell5key);
+ column3.addContent(cell5);
+ Element value5 = new Element("value");
+ value5.setText("content5");
+ cell5.addContent(value5);
+
+// nbt.put("table2", "column3", "6", "content6");
+// Element cell6 = new Element("cell");
+// Attribute cell6key = new Attribute("key", "6");
+// cell6.setAttribute(cell6key);
+// column3.addContent(cell6);
+// Element value6 = new Element("value");
+// value6.setText("content6");
+// cell6.addContent(value6);
+//
+// nbt.put("table2", "column4", "7", "content7");
+// Element cell7 = new Element("cell");
+// Attribute cell7key = new Attribute("key", "7");
+// cell7.setAttribute(cell7key);
+// column4.addContent(cell7);
+// Element value7 = new Element("value");
+// value7.setText("content7");
+// cell7.addContent(value7);
+//
+// nbt.put("table2", "column4", "8", "content8");
+// Element cell8 = new Element("cell");
+// Attribute cell8key = new Attribute("key", "8");
+// cell8.setAttribute(cell8key);
+// column4.addContent(cell8);
+// Element value8 = new Element("value");
+// value8.setText("content8");
+// cell8.addContent(value8);
+//
+// nbt.put("table2", "column5", "9", "content9");
+// Element cell9 = new Element("cell");
+// Attribute cell9key = new Attribute("key", "9");
+// cell9.setAttribute(cell9key);
+// column5.addContent(cell9);
+// Element value9 = new Element("value");
+// value9.setText("content9");
+// cell9.addContent(value9);
+//
+// nbt.put("table2", "column5", "10", "content10");
+// Element cell10 = new Element("cell");
+// Attribute cell10key = new Attribute("key", "10");
+// cell10.setAttribute(cell10key);
+// column5.addContent(cell10);
+// Element value10 = new Element("value");
+// value10.setText("content10");
+// cell10.addContent(value10);
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+
+
+// expected.toString();
+
+ Field fdocument;
+ try {
+ fdocument = exporter.getClass().getDeclaredField("document");
+ fdocument.setAccessible(true);
+ actual = (Document) fdocument.get(exporter);
+ } catch (IllegalArgumentException ex) {
+ LOG.error(ex, ex);
+ } catch (IllegalAccessException ex) {
+ LOG.error(ex, ex);
+ } catch (NoSuchFieldException ex) {
+ LOG.error(ex, ex);
+ } catch (SecurityException ex) {
+ LOG.error(ex, ex);
+ }
+
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ output.output(expected, System.out);
+ output.output(actual, System.out);
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+// assertEquals(expected,actual);
+// testEquals(expected.getRootElement(),actual.getRootElement());
+// System.out.println(expected);
+// System.out.println(actual);
+// assertEquals(expected.toString(),actual.toString());
+// assertEquals(expected, actual);
+ }
+
+ public static boolean testEquals(Element expected, Element actual) {
+
+ System.out.println(expected.getContent());
+ System.out.println(actual.getContent());
+
+ // same attribute list.
+// if (!expected.getAttributes().equals(actual.getAttributes())) {
+// return false;
+// }
+
+// if (!expected.getAttributes().equals(actual.getAttributes())) {
+// return false;
+// }
+
+// System.out.println(expected.getAttributes());
+// System.out.println(actual.getAttributes());
+ // same attributes values.
+// for (Attribute attribute : (List<Attribute>) expected.getAttributes()) {
+// String attrName = attribute.getName();
+// String expectedAttrValue = expected.getAttributeValue(attrName);
+// String actualAttrValue = actual.getAttributeValue(attrName);
+// if (!expectedAttrValue.equals(actualAttrValue)) {
+// return false;
+// }
+// }
+
+
+ List<Element> expectedChildren = (List<Element>) expected.getChildren();
+ List<Element> actualChildren = (List<Element>) actual.getChildren();
+
+ if (expectedChildren.size() != actualChildren.size()) {
+ return false;
+ } else if (expectedChildren.isEmpty()) {
+ return expected.getContent().equals(actual.getContent());
+ }
+// System.out.println(expectedChildren);
+// System.out.println(actualChildren);
+
+ boolean TF;
+ // same elements.
+ for (Element expectedChild : expectedChildren) {
+ TF = false;
+ for (Element actualChild : actualChildren) {
+ if(actualChild.getChildren().size() ==
+ expectedChild.getChildren().size()) {
+ if (testEquals(expectedChild,actualChild)) {
+// actualChildren.remove(actualChild);
+ TF = true;
+ } else {
+ // System.out.println(expectedChild.getChildren());
+ // System.out.println(actualChild.getChildren());
+ }
+ }
+ }
+// if (TF == false) {
+// return false;
+// }
+ }
+
+ return true;
+ }
+
+ public static void main(String[] args) {
+ NewBigTable nbt = new BigHashMap();
+ nbt.createTable("table1");
+ nbt.createTable("table2");
+
+ nbt.createColumn("table1", "column1");
+ nbt.createColumn("table1", "column2");
+
+ nbt.createColumn("table2", "column3");
+ nbt.createColumn("table2", "column4");
+ nbt.createColumn("table2", "column5");
+
+ nbt.put("table1", "column1", "1", "content1");
+ nbt.put("table1", "column1", "2", "content2");
+ nbt.put("table1", "column2", "3", "content3");
+ nbt.put("table1", "column2", "4", "content4");
+
+ nbt.put("table2", "column3", "5", "content5");
+ nbt.put("table2", "column3", "6", "content6");
+ nbt.put("table2", "column4", "7", "content7");
+ nbt.put("table2", "column4", "8", "content8");
+ nbt.put("table2", "column5", "9", "content9");
+ nbt.put("table2", "column5", "10", "content10");
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+
+ Document a = new Document();
+ Document b = new Document();
+ }
+}
1
0
r140 - in trunk/msm-fromtoXML/src: main/java/org/nuiton/mapstoragemanager/plugins/exporter test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 17:31:53 +0100 (Sat, 27 Feb 2010)
New Revision: 140
Modified:
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
Log:
Seem to be ok.
Maintenant, il va falloir que je trouve comment faire l'assertEquals entre deux documents XML jdom...
Modified: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java 2010-02-27 16:28:06 UTC (rev 139)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java 2010-02-27 16:31:53 UTC (rev 140)
@@ -121,31 +121,32 @@
for (String key : keys) {
try{
content = bigTable.get(tableName, columnName, key);
- }
- catch (NoSuchElementException e) {
-// LOG.warn(e, e);
- }
- if ( ! "".equals(content)) {
+ if ( ! "".equals(content)) {
- // new cell Element.
- Element cellElement = new Element("cell");
- // new attribute which contain the cell key.
- Attribute cellKeyAttribute = new Attribute("key", key);
- cellElement.setAttribute(cellKeyAttribute);
+ // new cell Element.
+ Element cellElement = new Element("cell");
+ // new attribute which contain the cell key.
+ Attribute cellKeyAttribute = new Attribute("key", key);
+ cellElement.setAttribute(cellKeyAttribute);
- // we add the cell to the column.
- column.addContent(cellElement);
+ // we add the cell to the column.
+ column.addContent(cellElement);
- // new value Element.
- Element valueElement = new Element("value");
-// // new attribute which contain the value version.
-// Attribute valueVersionAttribute = new Attribute("version", v);
-// valueElement.setAttribute(valueVersionAttribute);
- valueElement.setText(content);
+ // new value Element.
+ Element valueElement = new Element("value");
+ // // new attribute which contain the value version.
+ // Attribute valueVersionAttribute = new Attribute("version", v);
+ // valueElement.setAttribute(valueVersionAttribute);
+ valueElement.setText(content);
- // we add the value to the cell.
- cellElement.addContent(valueElement);
+ // we add the value to the cell.
+ cellElement.addContent(valueElement);
+ }
}
+ catch (NoSuchElementException e) {
+// LOG.warn(e, e);
+ }
+
}
}
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:28:06 UTC (rev 139)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:31:53 UTC (rev 140)
@@ -207,7 +207,7 @@
try {
XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
output.output(expected, System.out);
-// output.output(actual, System.out);
+ output.output(actual, System.out);
} catch (IOException ex) {
LOG.error(ex, ex);
}
1
0
r139 - trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 17:28:06 +0100 (Sat, 27 Feb 2010)
New Revision: 139
Modified:
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
Log:
Rectification :
- classe de test : OK
- classe ToXML : Nok.
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:24:45 UTC (rev 138)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:28:06 UTC (rev 139)
@@ -7,8 +7,6 @@
import java.io.IOException;
import java.lang.reflect.Field;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import junit.framework.TestCase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -113,77 +111,77 @@
value2.setText("content2");
cell2.addContent(value2);
-// nbt.put("table1", "column2", "3", "content3");
-// Element cell3 = new Element("cell");
-// Attribute cell3key = new Attribute("key", "3");
-// cell3.setAttribute(cell3key);
-// column2.addContent(cell3);
-// Element value3 = new Element("value");
-// value3.setText("content3");
-// cell3.addContent(value3);
+ nbt.put("table1", "column2", "3", "content3");
+ Element cell3 = new Element("cell");
+ Attribute cell3key = new Attribute("key", "3");
+ cell3.setAttribute(cell3key);
+ column2.addContent(cell3);
+ Element value3 = new Element("value");
+ value3.setText("content3");
+ cell3.addContent(value3);
-// nbt.put("table1", "column2", "4", "content4");
-// Element cell4 = new Element("cell");
-// Attribute cell4key = new Attribute("key", "4");
-// cell4.setAttribute(cell4key);
-// column2.addContent(cell4);
-// Element value4 = new Element("value");
-// value4.setText("content4");
-// cell4.addContent(value4);
+ nbt.put("table1", "column2", "4", "content4");
+ Element cell4 = new Element("cell");
+ Attribute cell4key = new Attribute("key", "4");
+ cell4.setAttribute(cell4key);
+ column2.addContent(cell4);
+ Element value4 = new Element("value");
+ value4.setText("content4");
+ cell4.addContent(value4);
-// nbt.put("table2", "column3", "5", "content5");
-// Element cell5 = new Element("cell");
-// Attribute cell5key = new Attribute("key", "5");
-// cell5.setAttribute(cell5key);
-// column3.addContent(cell5);
-// Element value5 = new Element("value");
-// value5.setText("content5");
-// cell5.addContent(value5);
+ nbt.put("table2", "column3", "5", "content5");
+ Element cell5 = new Element("cell");
+ Attribute cell5key = new Attribute("key", "5");
+ cell5.setAttribute(cell5key);
+ column3.addContent(cell5);
+ Element value5 = new Element("value");
+ value5.setText("content5");
+ cell5.addContent(value5);
-// nbt.put("table2", "column3", "6", "content6");
-// Element cell6 = new Element("cell");
-// Attribute cell6key = new Attribute("key", "6");
-// cell6.setAttribute(cell6key);
-// column3.addContent(cell6);
-// Element value6 = new Element("value");
-// value6.setText("content6");
-// cell6.addContent(value6);
+ nbt.put("table2", "column3", "6", "content6");
+ Element cell6 = new Element("cell");
+ Attribute cell6key = new Attribute("key", "6");
+ cell6.setAttribute(cell6key);
+ column3.addContent(cell6);
+ Element value6 = new Element("value");
+ value6.setText("content6");
+ cell6.addContent(value6);
-// nbt.put("table2", "column4", "7", "content7");
-// Element cell7 = new Element("cell");
-// Attribute cell7key = new Attribute("key", "7");
-// cell7.setAttribute(cell7key);
-// column4.addContent(cell7);
-// Element value7 = new Element("value");
-// value7.setText("content7");
-// cell7.addContent(value7);
+ nbt.put("table2", "column4", "7", "content7");
+ Element cell7 = new Element("cell");
+ Attribute cell7key = new Attribute("key", "7");
+ cell7.setAttribute(cell7key);
+ column4.addContent(cell7);
+ Element value7 = new Element("value");
+ value7.setText("content7");
+ cell7.addContent(value7);
-// nbt.put("table2", "column4", "8", "content8");
-// Element cell8 = new Element("cell");
-// Attribute cell8key = new Attribute("key", "8");
-// cell8.setAttribute(cell8key);
-// column4.addContent(cell8);
-// Element value8 = new Element("value");
-// value8.setText("content8");
-// cell8.addContent(value8);
+ nbt.put("table2", "column4", "8", "content8");
+ Element cell8 = new Element("cell");
+ Attribute cell8key = new Attribute("key", "8");
+ cell8.setAttribute(cell8key);
+ column4.addContent(cell8);
+ Element value8 = new Element("value");
+ value8.setText("content8");
+ cell8.addContent(value8);
-// nbt.put("table2", "column5", "9", "content9");
-// Element cell9 = new Element("cell");
-// Attribute cell9key = new Attribute("key", "9");
-// cell9.setAttribute(cell9key);
-// column5.addContent(cell9);
-// Element value9 = new Element("value");
-// value9.setText("content9");
-// cell9.addContent(value9);
+ nbt.put("table2", "column5", "9", "content9");
+ Element cell9 = new Element("cell");
+ Attribute cell9key = new Attribute("key", "9");
+ cell9.setAttribute(cell9key);
+ column5.addContent(cell9);
+ Element value9 = new Element("value");
+ value9.setText("content9");
+ cell9.addContent(value9);
-// nbt.put("table2", "column5", "10", "content10");
-// Element cell10 = new Element("cell");
-// Attribute cell10key = new Attribute("key", "10");
-// cell10.setAttribute(cell10key);
-// column5.addContent(cell10);
-// Element value10 = new Element("value");
-// value10.setText("content10");
-// cell10.addContent(value10);
+ nbt.put("table2", "column5", "10", "content10");
+ Element cell10 = new Element("cell");
+ Attribute cell10key = new Attribute("key", "10");
+ cell10.setAttribute(cell10key);
+ column5.addContent(cell10);
+ Element value10 = new Element("value");
+ value10.setText("content10");
+ cell10.addContent(value10);
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
@@ -209,7 +207,7 @@
try {
XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
output.output(expected, System.out);
- output.output(actual, System.out);
+// output.output(actual, System.out);
} catch (IOException ex) {
LOG.error(ex, ex);
}
1
0
r138 - in trunk/msm-fromtoXML/src: main/java/org/nuiton/mapstoragemanager/plugins/exporter test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 17:24:45 +0100 (Sat, 27 Feb 2010)
New Revision: 138
Modified:
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
Log:
commencement de classe de test pour ToXML (ne marche pas pour le moment).
Modified: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java 2010-02-27 04:20:25 UTC (rev 137)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java 2010-02-27 16:24:45 UTC (rev 138)
@@ -41,28 +41,14 @@
racine = new Element("database");
document = new Document(racine);
+ // Construction of the document.
forEachTable(bigTable, racine);
-// //On crée un nouvel Element etudiant et on l'ajoute
-// //en tant qu'Element de racine
-// Element etudiant = new Element("etudiant");
-// racine.addContent(etudiant);
-// for()
-// //On crée un nouvel Attribut classe et on l'ajoute à etudiant
-// //grâce à la méthode setAttribute
-// Attribute classe = new Attribute("classe", "P2");
-// etudiant.setAttribute(classe);
-//
-// //On crée un nouvel Element nom, on lui assigne du texte
-// //et on l'ajoute en tant qu'Element de etudiant
-// Element nom = new Element("nom");
-// nom.setText("CynO");
-// etudiant.addContent(nom);
-
// the methods to print and to save the database in XML file.
- toSreen();
- if(file != null)
+ //toSreen();
+ if (file != null) {
save(file);
+ }
}
/**
@@ -122,9 +108,6 @@
* @param column the column Element.
*/
private void forEachCell(NewBigTable bigTable, Element column) {
- System.out.println(column.getParentElement().toString());
-
-
// the table name.
String tableName =
column.getParentElement().getAttributeValue("tableName");
@@ -140,7 +123,7 @@
content = bigTable.get(tableName, columnName, key);
}
catch (NoSuchElementException e) {
-// LOG.error(e, e);
+// LOG.warn(e, e);
}
if ( ! "".equals(content)) {
Modified: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 04:20:25 UTC (rev 137)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 16:24:45 UTC (rev 138)
@@ -5,7 +5,18 @@
package org.nuiton.mapstoragemanager.plugins.exporter;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Attribute;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.NewBigTable;
import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
@@ -16,8 +27,197 @@
*/
public class ExporterTest extends TestCase {
- public void testToXML(){
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ExporterTest.class);
+// private static final Log LOGXML = LogFactory.getLog(ToXML.class);
+ public void testToXML() {
+
+ Document actual = null;
+ Document expected = new Document();
+
+ /********************************
+ * Creation of the database. *
+ ********************************/
+ NewBigTable nbt = new BigHashMap();
+ Element database = new Element("database");
+ expected.addContent(database);
+
+ /********************************
+ * Creation of the tables. *
+ ********************************/
+ nbt.createTable("table1");
+ Element table1 = new Element("table");
+ Attribute table1name = new Attribute("tableName", "table1");
+ table1.setAttribute(table1name);
+ database.addContent(table1);
+ nbt.createTable("table2");
+ Element table2 = new Element("table");
+ Attribute table2name = new Attribute("tableName", "table2");
+ table2.setAttribute(table2name);
+ database.addContent(table2);
+
+ /********************************
+ * Creation of the columns. *
+ ********************************/
+ nbt.createColumn("table1", "column1");
+ Element column1 = new Element("column");
+ Attribute column1name = new Attribute("columnName", "column1");
+ column1.setAttribute(column1name);
+ table1.addContent(column1);
+ nbt.createColumn("table1", "column2");
+ Element column2 = new Element("column");
+ Attribute column2name = new Attribute("columnName", "column2");
+ column2.setAttribute(column2name);
+ table1.addContent(column2);
+
+ nbt.createColumn("table2", "column3");
+ Element column3 = new Element("column");
+ Attribute column3name = new Attribute("columnName", "column3");
+ column3.setAttribute(column3name);
+ table2.addContent(column3);
+
+ nbt.createColumn("table2", "column4");
+ Element column4 = new Element("column");
+ Attribute column4name = new Attribute("columnName", "column4");
+ column4.setAttribute(column4name);
+ table2.addContent(column4);
+
+ nbt.createColumn("table2", "column5");
+ Element column5 = new Element("column");
+ Attribute column5name = new Attribute("columnName", "column5");
+ column5.setAttribute(column5name);
+ table2.addContent(column5);
+
+
+ /********************************
+ * Put elements in the columns. *
+ ********************************/
+ nbt.put("table1", "column1", "1", "content1");
+ Element cell1 = new Element("cell");
+ Attribute cell1key = new Attribute("key", "1");
+ cell1.setAttribute(cell1key);
+ column1.addContent(cell1);
+ Element value1 = new Element("value");
+ value1.setText("content1");
+ cell1.addContent(value1);
+
+ nbt.put("table1", "column1", "2", "content2");
+ Element cell2 = new Element("cell");
+ Attribute cell2key = new Attribute("key", "2");
+ cell2.setAttribute(cell2key);
+ column1.addContent(cell2);
+ Element value2 = new Element("value");
+ value2.setText("content2");
+ cell2.addContent(value2);
+
+// nbt.put("table1", "column2", "3", "content3");
+// Element cell3 = new Element("cell");
+// Attribute cell3key = new Attribute("key", "3");
+// cell3.setAttribute(cell3key);
+// column2.addContent(cell3);
+// Element value3 = new Element("value");
+// value3.setText("content3");
+// cell3.addContent(value3);
+
+// nbt.put("table1", "column2", "4", "content4");
+// Element cell4 = new Element("cell");
+// Attribute cell4key = new Attribute("key", "4");
+// cell4.setAttribute(cell4key);
+// column2.addContent(cell4);
+// Element value4 = new Element("value");
+// value4.setText("content4");
+// cell4.addContent(value4);
+
+// nbt.put("table2", "column3", "5", "content5");
+// Element cell5 = new Element("cell");
+// Attribute cell5key = new Attribute("key", "5");
+// cell5.setAttribute(cell5key);
+// column3.addContent(cell5);
+// Element value5 = new Element("value");
+// value5.setText("content5");
+// cell5.addContent(value5);
+
+// nbt.put("table2", "column3", "6", "content6");
+// Element cell6 = new Element("cell");
+// Attribute cell6key = new Attribute("key", "6");
+// cell6.setAttribute(cell6key);
+// column3.addContent(cell6);
+// Element value6 = new Element("value");
+// value6.setText("content6");
+// cell6.addContent(value6);
+
+// nbt.put("table2", "column4", "7", "content7");
+// Element cell7 = new Element("cell");
+// Attribute cell7key = new Attribute("key", "7");
+// cell7.setAttribute(cell7key);
+// column4.addContent(cell7);
+// Element value7 = new Element("value");
+// value7.setText("content7");
+// cell7.addContent(value7);
+
+// nbt.put("table2", "column4", "8", "content8");
+// Element cell8 = new Element("cell");
+// Attribute cell8key = new Attribute("key", "8");
+// cell8.setAttribute(cell8key);
+// column4.addContent(cell8);
+// Element value8 = new Element("value");
+// value8.setText("content8");
+// cell8.addContent(value8);
+
+// nbt.put("table2", "column5", "9", "content9");
+// Element cell9 = new Element("cell");
+// Attribute cell9key = new Attribute("key", "9");
+// cell9.setAttribute(cell9key);
+// column5.addContent(cell9);
+// Element value9 = new Element("value");
+// value9.setText("content9");
+// cell9.addContent(value9);
+
+// nbt.put("table2", "column5", "10", "content10");
+// Element cell10 = new Element("cell");
+// Attribute cell10key = new Attribute("key", "10");
+// cell10.setAttribute(cell10key);
+// column5.addContent(cell10);
+// Element value10 = new Element("value");
+// value10.setText("content10");
+// cell10.addContent(value10);
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+
+
+// expected.toString();
+
+ Field fdocument;
+ try {
+ fdocument = exporter.getClass().getDeclaredField("document");
+ fdocument.setAccessible(true);
+ actual = (Document) fdocument.get(exporter);
+ } catch (IllegalArgumentException ex) {
+ LOG.error(ex, ex);
+ } catch (IllegalAccessException ex) {
+ LOG.error(ex, ex);
+ } catch (NoSuchFieldException ex) {
+ LOG.error(ex, ex);
+ } catch (SecurityException ex) {
+ LOG.error(ex, ex);
+ }
+
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ output.output(expected, System.out);
+ output.output(actual, System.out);
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+
+// System.out.println(expected);
+// System.out.println(actual);
+// assertEquals(expected.toString(),actual.toString());
+// assertEquals(expected, actual);
}
public static void main(String[] args) {
@@ -46,5 +246,8 @@
Exporter exporter = new ToXML();
exporter.exportTo(nbt, null);
+
+ Document a = new Document();
+ Document b = new Document();
}
}
1
0
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 05:20:25 +0100 (Sat, 27 Feb 2010)
New Revision: 137
Added:
trunk/msm-fromtoXML/
trunk/msm-fromtoXML/LICENSE.txt
trunk/msm-fromtoXML/META-INF/
trunk/msm-fromtoXML/META-INF/services/
trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter
trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer
trunk/msm-fromtoXML/README.txt
trunk/msm-fromtoXML/changelog.txt
trunk/msm-fromtoXML/pom.xml
trunk/msm-fromtoXML/src/
trunk/msm-fromtoXML/src/main/
trunk/msm-fromtoXML/src/main/java/
trunk/msm-fromtoXML/src/main/java/org/
trunk/msm-fromtoXML/src/main/java/org/nuiton/
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/
trunk/msm-fromtoXML/src/site/
trunk/msm-fromtoXML/src/site/doc/
trunk/msm-fromtoXML/src/site/doc/xsd/
trunk/msm-fromtoXML/src/site/doc/xsd/example2.dtd
trunk/msm-fromtoXML/src/site/doc/xsd/example2.xml
trunk/msm-fromtoXML/src/site/todo.rst
trunk/msm-fromtoXML/src/test/
trunk/msm-fromtoXML/src/test/java/
trunk/msm-fromtoXML/src/test/java/org/
trunk/msm-fromtoXML/src/test/java/org/nuiton/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/
Modified:
trunk/msm-bighashmapV2/pom.xml
trunk/pom.xml
trunk/src/site/doc/analyse/importexport/example1.dtd
trunk/src/site/doc/analyse/importexport/example1.xml
trunk/src/site/doc/analyse/importexport/example2.dtd
trunk/src/site/doc/analyse/importexport/example2.xml
Log:
Cr?\195?\169ation et ajout d'un module d'import/export dans un format xml.
Ce n'est qu'un d?\195?\169but. La classe d'export est bien avanc?\195?\169e selon le second sch?\195?\169ma DTD que j'ai propos?\195?\169.
A noter qu'un test concr?\195?\170t du plugin MSM-BigHashMapV2 y est fait (insertion/r?\195?\169cup?\195?\169ration).
Je pense avoir d?\195?\169couvert une fonctionnalit?\195?\169 n?\195?\169c?\195?\169ssaire sur une "bigTable" : pouvoir r?\195?\169cup?\195?\169rer les diff?\195?\169rentes versions d'une "cellule" sans les conna?\195?\174tre..
Modified: trunk/msm-bighashmapV2/pom.xml
===================================================================
--- trunk/msm-bighashmapV2/pom.xml 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/msm-bighashmapV2/pom.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -23,7 +23,7 @@
</parent>
<groupId>org.nuiton</groupId>
- <artifactId>msm-bighashmapv2</artifactId>
+ <artifactId>msm-bighashmapV2</artifactId>
<version>0.1-SNAPSHOT</version>
<dependencies>
Added: trunk/msm-fromtoXML/LICENSE.txt
===================================================================
--- trunk/msm-fromtoXML/LICENSE.txt (rev 0)
+++ trunk/msm-fromtoXML/LICENSE.txt 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Added: trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter
===================================================================
--- trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter (rev 0)
+++ trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1 @@
+org.nuiton.mapstoragemanager.plugins.exporter.ToXML
\ No newline at end of file
Added: trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer
===================================================================
--- trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer (rev 0)
+++ trunk/msm-fromtoXML/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1 @@
+org.nuiton.mapstoragemanager.plugins.importer.FromXML
\ No newline at end of file
Added: trunk/msm-fromtoXML/changelog.txt
===================================================================
--- trunk/msm-fromtoXML/changelog.txt (rev 0)
+++ trunk/msm-fromtoXML/changelog.txt 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,2 @@
+Changelog is not any longer maintained, please refer to the release note :
+ http://maven-site.nuiton.org/mapstoragemanager/changes-report.html
Added: trunk/msm-fromtoXML/pom.xml
===================================================================
--- trunk/msm-fromtoXML/pom.xml (rev 0)
+++ trunk/msm-fromtoXML/pom.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,220 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!-- repository containing the parent pom. -->
+ <repositories>
+ <repository>
+ <id>org.nuiton</id>
+ <url>http://maven.nuiton.org/release</url>
+ </repository>
+ </repositories>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>mapstoragemanager</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm-fromtoxml</artifactId>
+ <version>0.1-SNAPSHOT</version>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm-bighashmapV2</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>${lutinutil.version}</version>
+ </dependency>-->
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <!-- JUnit for tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.1</version>
+ </dependency>
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>MSM-FromToXML</name>
+
+ <description>Plugin for MapStorageManager to work with actuals HBase</description>
+ <inceptionYear>2010</inceptionYear>
+
+ <developers>
+ <developer>
+ <id>tchemit</id>
+ <name>Tony Chemit</name>
+ <email>chemit(a)codelutin.com</email>
+ <organization>CodeLutin</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>fdesbois</id>
+ <name>Florian Desbois</name>
+ <email>fdesbois(a)codelutin.com</email>
+ <organization>CodeLutin</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>fgilet</id>
+ <name>Florent Gilet</name>
+ <email>florent.gilet(a)etu.univ-nantes.fr</email>
+ <organization>Université de nantes</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>gcrieloue</id>
+ <name>Gilles Crieloue</name>
+ <email>gilles.crieloue(a)etu.univ-nantes.fr</email>
+ <organization>Université de nantes</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>afages</id>
+ <name>Amaury Fages</name>
+ <email>amaury.fages(a)etu.univ-nantes.fr</email>
+ <organization>Université de nantes</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ <developer>
+ <id>dlanglais</id>
+ <name>Dorian langlais</name>
+ <email>dorain.langlais(a)etu.univ-nantes.fr</email>
+ <organization>Université de nantes</organization>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+ <packaging>jar</packaging>
+
+ <build>
+
+ <!--<plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-deps</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <silent>true</silent>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+
+ </plugin>
+
+ </plugins>-->
+
+ <pluginManagement>
+ <plugins>
+
+ <!--<plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <copyToMETA_INF>true</copyToMETA_INF>
+ </configuration>
+ </plugin>-->
+
+ <!--<plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathPrefix>./lib/</classpathPrefix>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>-->
+
+ <!-- plugin site -->
+ <!--<plugin>
+ <artifactId>maven-site-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>doxia-module-jrst</artifactId>
+ <version>${jrst.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>-->
+
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
+
+
+
+
+
+
+
Added: trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java
===================================================================
--- trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java (rev 0)
+++ trunk/msm-fromtoXML/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXML.java 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,194 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.mapstoragemanager.plugins.exporter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdom.Attribute;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+
+/**
+ * A Class to export in xml files the content of Hbase database.
+ * @author Dorian Langlais
+ */
+public class ToXML implements Exporter {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ToXML.class);
+
+ // the racine which is the database.
+ private static Element racine;
+
+ // the jdom document.
+ private static Document document;
+
+ @Override
+ public void exportTo(NewBigTable bigTable, File file) {
+
+ racine = new Element("database");
+ document = new Document(racine);
+
+ forEachTable(bigTable, racine);
+// //On crée un nouvel Element etudiant et on l'ajoute
+// //en tant qu'Element de racine
+// Element etudiant = new Element("etudiant");
+// racine.addContent(etudiant);
+
+// for()
+// //On crée un nouvel Attribut classe et on l'ajoute à etudiant
+// //grâce à la méthode setAttribute
+// Attribute classe = new Attribute("classe", "P2");
+// etudiant.setAttribute(classe);
+//
+// //On crée un nouvel Element nom, on lui assigne du texte
+// //et on l'ajoute en tant qu'Element de etudiant
+// Element nom = new Element("nom");
+// nom.setText("CynO");
+// etudiant.addContent(nom);
+
+ // the methods to print and to save the database in XML file.
+ toSreen();
+ if(file != null)
+ save(file);
+ }
+
+ /**
+ * For eath table of the database, the document is constructed.
+ * @param bigTable the bigTable.
+ * @param database the database Element.
+ */
+ private void forEachTable(NewBigTable bigTable, Element database) {
+ // the tables name.
+ Set<String> tablesNames = bigTable.getTablesNames();
+
+ for (String table : tablesNames) {
+ // new table Element.
+ Element tableElement = new Element("table");
+ // new attribute which contain the table name.
+ Attribute tableNameAttribute = new Attribute("tableName", table);
+ tableElement.setAttribute(tableNameAttribute);
+
+ // we add the table to the database.
+ database.addContent(tableElement);
+
+ // we search the columns of the table.
+ forEachColumn(bigTable, tableElement);
+ }
+ }
+
+ /**
+ * For eath column of the table, the document is constructed.
+ * @param bigTable the bigTable.
+ * @param table the table Element.
+ */
+ private void forEachColumn(NewBigTable bigTable, Element table) {
+ // the table name.
+ String tableName = table.getAttributeValue("tableName");
+
+ // the columns name.
+ Set<String> columnNames = bigTable.getColumnsNames(tableName);
+
+ for (String column : columnNames) {
+ // new column Element.
+ Element columnElement = new Element("column");
+ // new attribute which contain the column name.
+ Attribute columnNameAttribute = new Attribute("columnName", column);
+ columnElement.setAttribute(columnNameAttribute);
+
+ // we add the column to the table.
+ table.addContent(columnElement);
+
+ // we search the columns of the table.
+ forEachCell(bigTable, columnElement);
+ }
+ }
+
+ /**
+ * For eath cell of the column, the document is constructed.
+ * @param bigTable the bigTable.
+ * @param column the column Element.
+ */
+ private void forEachCell(NewBigTable bigTable, Element column) {
+ System.out.println(column.getParentElement().toString());
+
+
+ // the table name.
+ String tableName =
+ column.getParentElement().getAttributeValue("tableName");
+ // the column name.
+ String columnName = column.getAttributeValue("columnName");
+
+ // the table keys.
+ Set<String> keys = bigTable.getKeys(tableName);
+
+ String content = "";
+ for (String key : keys) {
+ try{
+ content = bigTable.get(tableName, columnName, key);
+ }
+ catch (NoSuchElementException e) {
+// LOG.error(e, e);
+ }
+ if ( ! "".equals(content)) {
+
+ // new cell Element.
+ Element cellElement = new Element("cell");
+ // new attribute which contain the cell key.
+ Attribute cellKeyAttribute = new Attribute("key", key);
+ cellElement.setAttribute(cellKeyAttribute);
+
+ // we add the cell to the column.
+ column.addContent(cellElement);
+
+ // new value Element.
+ Element valueElement = new Element("value");
+// // new attribute which contain the value version.
+// Attribute valueVersionAttribute = new Attribute("version", v);
+// valueElement.setAttribute(valueVersionAttribute);
+ valueElement.setText(content);
+
+ // we add the value to the cell.
+ cellElement.addContent(valueElement);
+ }
+ }
+ }
+
+ /**
+ * toSreen().
+ * show the XML content on System.out
+ */
+ static void toSreen() {
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ output.output(document, System.out);
+ } catch (java.io.IOException e) {
+ LOG.error(e, e);
+ }
+ }
+
+ /**
+ * Method to save the file.
+ * @param file the file in which we save the database.
+ */
+ private static void save(File file) {
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ output.output(document, new FileOutputStream(file));
+ } catch (java.io.IOException e) {
+ LOG.error(e, e);
+ }
+ }
+}
Added: trunk/msm-fromtoXML/src/site/doc/xsd/example2.dtd
===================================================================
--- trunk/msm-fromtoXML/src/site/doc/xsd/example2.dtd (rev 0)
+++ trunk/msm-fromtoXML/src/site/doc/xsd/example2.dtd 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ TODO define vocabulary identification
+ PUBLIC ID: -//vendor//vocabulary//EN
+ SYSTEM ID: http://server/path/example2.dtd
+
+-->
+
+<!--
+ An example how to use this DTD from your XML document:
+
+ <?xml version="1.0"?>
+
+ <!DOCTYPE root SYSTEM "example2.dtd">
+
+ <root>
+ ...
+ </root>
+-->
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT database (table)*>
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT table (column)*>
+<!ATTLIST table
+ tableName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT column (cell)*>
+<!ATTLIST column
+ columnName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT cell (value)*>
+<!ATTLIST cell
+ key CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT value (#PCDATA)>
+<!ATTLIST value
+ version CDATA #IMPLIED
+ >
Added: trunk/msm-fromtoXML/src/site/doc/xsd/example2.xml
===================================================================
--- trunk/msm-fromtoXML/src/site/doc/xsd/example2.xml (rev 0)
+++ trunk/msm-fromtoXML/src/site/doc/xsd/example2.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Document : export2.xml.xml
+ Created on : 26 février 2010, 15:19
+ Author : Dorian Langlais
+ Description:
+ An other example of format to export hbase content
+-->
+
+<database>
+ <table tableName="myLittleHBaseTable">
+ <column columnName="myLittleFamily">
+ <cell key="1">
+ <value version="1">bla</value>
+ <value version="2">blabla</value>
+ <value version="3">bla</value>
+ <value version="4">bla</value>
+ </cell>
+ <cell key="2">
+ <value version="1">blablablablablabla</value>
+ <value version="2">blabla</value>
+ </cell>
+ <cell key="3">
+ <value version="1">bla</value>
+ </cell>
+ <cell key="4">
+ <value version="1">bla</value>
+ </cell>
+ </column>
+ </table>
+</database>
Added: trunk/msm-fromtoXML/src/site/todo.rst
===================================================================
--- trunk/msm-fromtoXML/src/site/todo.rst (rev 0)
+++ trunk/msm-fromtoXML/src/site/todo.rst 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,6 @@
+
+Function to implement in toXML
+=========================================
+
+ - exportToXml [pending]
+ - importFromXml [pending]
\ No newline at end of file
Added: trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java
===================================================================
--- trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java (rev 0)
+++ trunk/msm-fromtoXML/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ExporterTest.java 2010-02-27 04:20:25 UTC (rev 137)
@@ -0,0 +1,50 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins.exporter;
+
+import junit.framework.TestCase;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+import org.nuiton.mapstoragemanager.plugins.NewBigTable;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMap;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class ExporterTest extends TestCase {
+
+ public void testToXML(){
+
+ }
+
+ public static void main(String[] args) {
+ NewBigTable nbt = new BigHashMap();
+ nbt.createTable("table1");
+ nbt.createTable("table2");
+
+ nbt.createColumn("table1", "column1");
+ nbt.createColumn("table1", "column2");
+
+ nbt.createColumn("table2", "column3");
+ nbt.createColumn("table2", "column4");
+ nbt.createColumn("table2", "column5");
+
+ nbt.put("table1", "column1", "1", "content1");
+ nbt.put("table1", "column1", "2", "content2");
+ nbt.put("table1", "column2", "3", "content3");
+ nbt.put("table1", "column2", "4", "content4");
+
+ nbt.put("table2", "column3", "5", "content5");
+ nbt.put("table2", "column3", "6", "content6");
+ nbt.put("table2", "column4", "7", "content7");
+ nbt.put("table2", "column4", "8", "content8");
+ nbt.put("table2", "column5", "9", "content9");
+ nbt.put("table2", "column5", "10", "content10");
+
+ Exporter exporter = new ToXML();
+ exporter.exportTo(nbt, null);
+ }
+}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/pom.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -21,6 +21,7 @@
<module>msm-bighashmap</module>
<module>msm-bighashmapV2</module>
<module>msm-hbase</module>
+ <module>msm-fromtoXML</module>
</modules>
<!-- ************************************************************* -->
Modified: trunk/src/site/doc/analyse/importexport/example1.dtd
===================================================================
--- trunk/src/site/doc/analyse/importexport/example1.dtd 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/src/site/doc/analyse/importexport/example1.dtd 2010-02-27 04:20:25 UTC (rev 137)
@@ -20,7 +20,7 @@
-->
<!--- Put your DTDDoc comment here. -->
-<!ELEMENT root (element)*>
+<!ELEMENT database (element)*>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT element EMPTY>
Modified: trunk/src/site/doc/analyse/importexport/example1.xml
===================================================================
--- trunk/src/site/doc/analyse/importexport/example1.xml 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/src/site/doc/analyse/importexport/example1.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -8,7 +8,7 @@
An example of format to export hbase content
-->
-<root>
+<database>
<element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="1" value="bla" />
<element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="2" value="blabla" />
<element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="3" value="bla" />
@@ -17,4 +17,4 @@
<element table="myLittleHBaseTable" column="myLittleFamily" key="2" version="2" value="blabla" />
<element table="myLittleHBaseTable" column="myLittleFamily" key="3" version="1" value="bla" />
<element table="myLittleHBaseTable" column="myLittleFamily" key="4" version="1" value="bla" />
-</root>
+</database>
Modified: trunk/src/site/doc/analyse/importexport/example2.dtd
===================================================================
--- trunk/src/site/doc/analyse/importexport/example2.dtd 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/src/site/doc/analyse/importexport/example2.dtd 2010-02-27 04:20:25 UTC (rev 137)
@@ -20,7 +20,7 @@
-->
<!--- Put your DTDDoc comment here. -->
-<!ELEMENT root (table)*>
+<!ELEMENT database (table)*>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT table (column)*>
Modified: trunk/src/site/doc/analyse/importexport/example2.xml
===================================================================
--- trunk/src/site/doc/analyse/importexport/example2.xml 2010-02-27 02:23:19 UTC (rev 136)
+++ trunk/src/site/doc/analyse/importexport/example2.xml 2010-02-27 04:20:25 UTC (rev 137)
@@ -8,7 +8,7 @@
An other example of format to export hbase content
-->
-<root>
+<database>
<table tableName="myLittleHBaseTable">
<column columnName="myLittleFamily">
<cell key="1">
@@ -29,4 +29,4 @@
</cell>
</column>
</table>
-</root>
+</database>
1
0
Author: dlanglais
Date: 2010-02-27 03:23:19 +0100 (Sat, 27 Feb 2010)
New Revision: 136
Modified:
trunk/msm/src/main/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
Log:
Oubli de commit des modifs sur les fichiers i18n
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-27 02:15:31 UTC (rev 135)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-27 02:23:19 UTC (rev 136)
@@ -4,6 +4,7 @@
connectionError=The connection attempt to failed, please retry \!
jaxxdemo.message.goto.site=Visit site
jaxxdemo.tree.component=
+keys=
login\ \:=Login
mapstoragemanager.action.aboutUs=About us
mapstoragemanager.action.aboutUs.tip=About Code Lutin
Modified: trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-27 02:15:31 UTC (rev 135)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-27 02:23:19 UTC (rev 136)
@@ -4,6 +4,7 @@
connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
jaxxdemo.message.goto.site=Visitez le site
jaxxdemo.tree.component=
+keys=
login\ \:=Identifiant
mapstoragemanager.action.aboutUs=A propos
mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
1
0
r135 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 03:15:31 +0100 (Sat, 27 Feb 2010)
New Revision: 135
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
Log:
modif mineure sur OutHashMap2.java (condition "combinable").
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-27 02:13:12 UTC (rev 134)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-27 02:15:31 UTC (rev 135)
@@ -65,11 +65,10 @@
@Override
public void put(String table, String column, String key, String content) {
- if(mapTable.containsKey(table)){
- if(mapColumn.containsKey(column)){
- mapColumn.get(column).add(key);
- mapData.put(key, content);
- }
+ // If the table and the column exist.
+ if(mapTable.containsKey(table) && mapColumn.containsKey(column)) {
+ mapColumn.get(column).add(key);
+ mapData.put(key, content);
}
}
1
0
r134 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 03:13:12 +0100 (Sat, 27 Feb 2010)
New Revision: 134
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Tentative traduction Keys/Cl?\195?\169s dans le tableau affichant le contenu d'une table.
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-27 02:06:19 UTC (rev 133)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-27 02:13:12 UTC (rev 134)
@@ -199,7 +199,7 @@
* Show help.
*/
public void showHelp() {
- String message=n_("No help today, sorry !");
+ String message = n_("No help today, sorry !");
JOptionPane.showMessageDialog(null, message);
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-27 02:06:19 UTC (rev 133)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-27 02:13:12 UTC (rev 134)
@@ -11,6 +11,8 @@
import javax.swing.tree.DefaultMutableTreeNode;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* Model of a table content
* @author E045231P
@@ -49,7 +51,7 @@
data = new String[columnsNames.size()+1][tableKeys.size()];
// a column which shows keys.
- titles[colIndex++] = "keys";
+ titles[colIndex++] = n_("keys");
while(i.hasNext()){
String titreTemp = i.next();
1
0
r133 - in trunk/msm/src/main/java/org/nuiton/mapstoragemanager: plugins ui/gui
by dlanglais@users.nuiton.org Feb. 27, 2010
by dlanglais@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: dlanglais
Date: 2010-02-27 03:06:19 +0100 (Sat, 27 Feb 2010)
New Revision: 133
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
Log:
Am?\195?\169lioration code OurHashMap2 (plus compr?\195?\169hensible de mon point de vue, mais c'est subjectif).
Ajout d'une colonne keys dans le tableau d'une table.
-> modification des objets stock?\195?\169s pour "mieux s'y retrouver -> les doublons peuvent faire croire que tout marche...).
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-27 00:45:14 UTC (rev 132)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-27 02:06:19 UTC (rev 133)
@@ -41,18 +41,18 @@
@Override
public void createColumn(String table, String column) {
- if(mapTable.containsKey(table)){
+ // if the table exist and only if the column doesn't exist.
+ if (mapTable.containsKey(table) && !mapColumn.containsKey(column)) {
mapColumn.put(column, new ArrayList<String>());
- ArrayList<String> list;
- list = mapTable.get(table);
- list.add(column);
- mapTable.put(table,list);
+ mapTable.get(table).add(column);
}
}
@Override
public void deleteColumn(String table, String column) {
- if(mapTable.containsKey(table)){
+ // if the table exist and only if the column exist.
+ if (mapTable.containsKey(table) &&
+ mapTable.get(table).contains(column)) {
mapTable.get(table).remove(column);
}
}
@@ -67,10 +67,7 @@
public void put(String table, String column, String key, String content) {
if(mapTable.containsKey(table)){
if(mapColumn.containsKey(column)){
- ArrayList<String> list;
- list = mapColumn.get(column);
- list.add(key);
- mapColumn.put(column,list);
+ mapColumn.get(column).add(key);
mapData.put(key, content);
}
}
@@ -104,17 +101,16 @@
@Override
public Set<String> getKeys(String table) {
- Set<String> keys = new HashSet();
- Set<String> column = new HashSet(mapTable.get(table));
- Iterator i = column.iterator();
+ Set<String> tableKeys = new HashSet();
+ Set<String> tableColumns = new HashSet(mapTable.get(table));
+ Iterator<String> i = tableColumns.iterator();
+ // we get and add all the keys of the column to the keys of the table
while(i.hasNext()){
- String columnName = (String)i.next();
- ArrayList<String> al = mapColumn.get(columnName);
- for(int j=0;j<al.size();j++){
- keys.add(al.get(j));
- }
+ String columnName = i.next();
+ ArrayList<String> columnKeys = mapColumn.get(columnName);
+ tableKeys.addAll(columnKeys);
}
- return keys;
+ return tableKeys;
}
public Set<String> getKeys(String table, String column) {
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-27 00:45:14 UTC (rev 132)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-27 02:06:19 UTC (rev 133)
@@ -74,12 +74,12 @@
ohm.put("table1", "column2", "3", "content3");
ohm.put("table1", "column2", "4", "content4");
- ohm.put("table2", "column3", "5", "content1");
- ohm.put("table2", "column3", "6", "content2");
- ohm.put("table2", "column4", "7", "content3");
- ohm.put("table2", "column4", "8", "content4");
- ohm.put("table2", "column5", "9", "content3");
- ohm.put("table2", "column5", "10", "content4");
+ ohm.put("table2", "column3", "5", "content5");
+ ohm.put("table2", "column3", "6", "content6");
+ ohm.put("table2", "column4", "7", "content7");
+ ohm.put("table2", "column4", "8", "content8");
+ ohm.put("table2", "column5", "9", "content9");
+ ohm.put("table2", "column5", "10", "content10");
}
/**
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-27 00:45:14 UTC (rev 132)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-27 02:06:19 UTC (rev 133)
@@ -21,7 +21,7 @@
/**
* columnNames.
*/
- String[] titres;
+ String[] titles;
/**
* data.
@@ -34,38 +34,59 @@
public TableModel(DefaultMutableTreeNode node) {
String table = node.toString();
ApplicationEngine engine = ApplicationEngine.getInstance();
- OurHashMap2 testHashmap2 = engine.getOurHashMap();
- Set<String> set = testHashmap2.getColumnsNames(table);
- titres = new String[set.size()];
+ OurHashMap2 hashmap = engine.getOurHashMap();
+ Set<String> columnsNames = hashmap.getColumnsNames(table);
+ titles = new String[columnsNames.size()+1];
+
//content
- Set<String> keySetTable = testHashmap2.getKeys(table);
- Iterator i = set.iterator();
- int j=0;
- int k=0;
- System.out.println("set.size() : "+set.size()+" | keySet.size() : "+keySetTable.size());
- data = new String[set.size()][keySetTable.size()];
+ Set<String> tableKeys = hashmap.getKeys(table);
+ Iterator<String> i = columnsNames.iterator();
+ int colIndex = 0;
+ int rowIndex = 0;
+ System.out.println("set.size() : " + columnsNames.size()
+ + " | keySet.size() : " + tableKeys.size());
+ data = new String[columnsNames.size()+1][tableKeys.size()];
+
+ // a column which shows keys.
+ titles[colIndex++] = "keys";
+
while(i.hasNext()){
- String titreTemp = (String)i.next();
- titres[j]=titreTemp;
+ String titreTemp = i.next();
+ titles[colIndex] = titreTemp;
- Set<String> keySet = testHashmap2.getKeys(table,titres[j]);
- Iterator i2 = keySet.iterator();
+ Set<String> columnKeys =
+ hashmap.getKeys(table, titles[colIndex]);
+ Iterator<String> i2 = columnKeys.iterator();
while(i2.hasNext()){
- System.out.println("table = "+table);
- System.out.println("titreTemp = "+titreTemp);
- String str = testHashmap2.get(table,titreTemp,(String)i2.next());
- data[j][k]=str;
- System.out.println("data["+j+"]["+k+"] = "+data[j][k]);
- k++;
+ String key = i2.next();
+ System.out.println("table = " + table);
+ System.out.println("titreTemp = " + titreTemp);
+ String str = hashmap.get(table, titreTemp, key);
+ //data[j][k]=str;
+ // the key
+ this.setValueAt(rowIndex, 0, key);
+ this.setValueAt(rowIndex, colIndex, str);
+ System.out.println("data[" + colIndex + "][" + rowIndex + "] = "
+ + data[colIndex][rowIndex]);
+ rowIndex++;
}
- j++;
+ colIndex++;
}
}
+ /**
+ * put data into the table.
+ * @param rowIndex the rox index
+ * @param colIndex the column index
+ * @param value to put in the table.
+ */
+ public void setValueAt(int rowIndex, int colIndex, String value) {
+ data[colIndex][rowIndex] = value;
+ }
/**
- * Add data into the table.
+ * get data from the table.
* @param rowIndex the rox index
* @param colIndex the column index
*/
@@ -80,7 +101,7 @@
*/
@Override
public int getColumnCount() {
- return titres.length;
+ return titles.length;
}
/**
@@ -99,7 +120,7 @@
*/
@Override
public String getColumnName(int col){
- return titres[col];
+ return titles[col];
}
1
0
r132 - in trunk/msm/src/main: java/org/nuiton/mapstoragemanager java/org/nuiton/mapstoragemanager/plugins java/org/nuiton/mapstoragemanager/ui java/org/nuiton/mapstoragemanager/ui/gui resources resources/i18n resources/icons
by fgilet@users.nuiton.org Feb. 27, 2010
by fgilet@users.nuiton.org Feb. 27, 2010
Feb. 27, 2010
Author: fgilet
Date: 2010-02-27 01:45:14 +0100 (Sat, 27 Feb 2010)
New Revision: 132
Added:
trunk/msm/src/main/resources/icons/action-connect.png
trunk/msm/src/main/resources/icons/action-disconnect.png
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/MsmConfig.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
trunk/msm/src/main/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
trunk/msm/src/main/resources/msm.properties
Log:
Ajout d'images dans le menu.
menu "aide", "visitez site" et "?\195?\160 propos" fait partiellement.
menu connect et disconnect mis ?\195?\160 jour.
contenu d'une table mis ?\195?\160 jour dans un jscrollpane. (donc vu des colonnes)
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -80,10 +80,10 @@
private void init() {
MainUI ui = MainUI.getInstance();
- Locale locale = Main.locale;
- if (locale.equals(Locale.FRANCE)){
+ Locale localeTemp = Main.locale;
+ if (localeTemp.equals(Locale.FRANCE)){
ui.getMenuFileLanguageFR().setEnabled(false);
- } else if (locale.equals(Locale.UK)){
+ } else if (localeTemp.equals(Locale.UK)){
ui.getMenuFileLanguageUK().setEnabled(false);
}
String message = n_("messageEntry");
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/MsmConfig.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/MsmConfig.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/MsmConfig.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -22,6 +22,7 @@
* to use log facility, just put in your code: log.info(\"...\");
*/
static private Log log = LogFactory.getLog(MsmConfig.class);
+
/**
* le fichier de configuration de l'application avec les informations sur
* le projet (version, license,...) et la configuration des ui (icons, ...)
@@ -30,6 +31,8 @@
public MsmConfig() {
+ //setConfigFileName(APPLICATION_PROPERTIES);
+
// chargement de la configuration interne
InputStream stream = getClass().getResourceAsStream(
APPLICATION_PROPERTIES);
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -41,8 +41,8 @@
@Override
public void createColumn(String table, String column) {
- mapColumn.put(column, new ArrayList<String>());
if(mapTable.containsKey(table)){
+ mapColumn.put(column, new ArrayList<String>());
ArrayList<String> list;
list = mapTable.get(table);
list.add(column);
@@ -53,9 +53,6 @@
@Override
public void deleteColumn(String table, String column) {
if(mapTable.containsKey(table)){
- /*ArrayList<String> list = mapTable.get(table);
- list.remove(column);
- mapTable.put(table,list);*/
mapTable.get(table).remove(column);
}
}
@@ -70,11 +67,10 @@
public void put(String table, String column, String key, String content) {
if(mapTable.containsKey(table)){
if(mapColumn.containsKey(column)){
- /*ArrayList<String> list;
+ ArrayList<String> list;
list = mapColumn.get(column);
list.add(key);
- mapColumn.put(column,list);*/
- mapColumn.get(column).add(key);
+ mapColumn.put(column,list);
mapData.put(key, content);
}
}
@@ -108,16 +104,14 @@
@Override
public Set<String> getKeys(String table) {
- Set<String> keys = null;
+ Set<String> keys = new HashSet();
Set<String> column = new HashSet(mapTable.get(table));
Iterator i = column.iterator();
while(i.hasNext()){
String columnName = (String)i.next();
- System.out.println("columnName : "+columnName);
ArrayList<String> al = mapColumn.get(columnName);
- for(String str : al){
- System.out.println("str : "+str);
- keys.add(str);
+ for(int j=0;j<al.size();j++){
+ keys.add(al.get(j));
}
}
return keys;
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-02-27 00:45:14 UTC (rev 132)
@@ -38,12 +38,14 @@
#menuConnect {
text:"mapstoragemanager.action.connect";
toolTipText:"mapstoragemanager.action.connect.tip";
+ actionIcon:"connect";
mnemonic:C;
}
#menuDisconnect {
text:"mapstoragemanager.action.disconnect";
toolTipText:"mapstoragemanager.action.disconnect.tip";
+ actionIcon:"disconnect";
mnemonic:D;
}
@@ -114,6 +116,11 @@
title:"Map Storage Manager";
}
+#toolBar {
+ visible:false;
+}
+
+
JLabel.boldUnderline {
font-weight: bold;
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-02-27 00:45:14 UTC (rev 132)
@@ -8,6 +8,7 @@
import javax.swing.tree.*;
import static org.nuiton.i18n.I18n.n_;
import javax.swing.JLabel;
+ import org.nuiton.mapstoragemanager.MsmConfig;
ApplicationEngine engine = ApplicationEngine.getInstance();
@@ -36,6 +37,14 @@
}
/**
+ * Access to the config.
+ * @return instance of the class
+ */
+ public MsmConfig getConfig() {
+ return getContextValue(MsmConfig.class);
+ }
+
+ /**
* Dispose UI.
*/
public void dispose(){
@@ -51,17 +60,18 @@
*/
public void displayMessage(String message, int code){
this.getMessagesPanel().removeAll();
- JLabel label = new JLabel(message);
+
/*
if (code==0){
- ImageIcon = new ImageIcon("ok_16.png");
+ ImageIcon icon = new ImageIcon(getClass().getResource("ok_16.png"));
}else if (code==1){
- ImageIcon = new ImageIcon("warning_16.png");
+ ImageIcon icon = new ImageIcon(getClass().getResource("warning_16.png"));
}else if (code==2){
- ImageIcon = new ImageIcon("cancel_16.png");
+ ImageIcon icon = new ImageIcon(getClass().getResource("cancel_16.png"));
}
*/
- //label.setIcon(icon);
+ //JLabel label = new JLabel(message, icon, SwingConstants.CENTER);
+ JLabel label = new JLabel(message);
this.getMessagesPanel().add(label);
}
@@ -77,9 +87,9 @@
<JMenuBar>
<JMenu id='menuFile'>
<JMenuItem id='menuConnect'
- onActionPerformed='engine.doSomething()'/>
- <JMenuItem id='menuDisconnect'
- onActionPerformed='engine.doSomething()'/>
+ onActionPerformed='engine.showToolBar()'/>
+ <JMenuItem id='menuDisconnect' enabled='false'
+ onActionPerformed='engine.disposeToolBar()'/>
<JSeparator/>
<JMenuItem id='menuExit'
onActionPerformed='engine.close()'/>
@@ -100,47 +110,46 @@
<JMenu id='menuHelp'>
<JMenuItem id='menuHelpHelp'
- onActionPerformed='engine.doSomething()'/>
+ onActionPerformed='engine.showHelp()'/>
<JMenuItem id='menuHelpSite'
- onActionPerformed='engine.doSomething()'/>
+ onActionPerformed='engine.gotoSite()'/>
<JMenuItem id='menuHelpAbout'
- onActionPerformed='engine.doSomething()'/>
+ onActionPerformed='engine.showAbout()'/>
</JMenu>
-
</JMenuBar>
<JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
- <JPanel layout='{new BorderLayout()}' id='mainPanel'>
- <JToolBar constraints='BorderLayout.NORTH' opaque='true'>
- <JLabel text="name base :" actionIcon='database_16' styleClass='boldUnderline' />
- <JAXXComboBox id='nameBase' onActionPerformed='engine.doSomething()' >
- <item value='OurHashMap' selected='true'/>
- <item value='HBase'/>
- <item value='Cassandra'/>
- <item value='Other'/>
- </JAXXComboBox>
- <JLabel text="login :" actionIcon='login_16' styleClass='boldUnderline'/>
- <JTextField id='login'/>
- <JLabel text="password :" actionIcon='password_16' styleClass='boldUnderline'/>
- <JPasswordField id='password'/>
- <JButton text="ok" actionIcon='ok_16' onActionPerformed='engine.connection()'/>
- </JToolBar>
+ <JPanel layout='{new BorderLayout()}' id='mainPanel'>
+ <JToolBar id='toolBar' constraints='BorderLayout.NORTH' opaque='true' >
+ <JLabel text="name base :" actionIcon='database_16' styleClass='boldUnderline' />
+ <JAXXComboBox id='nameBase' onActionPerformed='engine.doSomething()' >
+ <item value='OurHashMap' selected='true'/>
+ <item value='HBase'/>
+ <item value='Cassandra'/>
+ <item value='Other'/>
+ </JAXXComboBox>
+ <JLabel text="login :" actionIcon='login_16' styleClass='boldUnderline'/>
+ <JTextField id='login'/>
+ <JLabel text="password :" actionIcon='password_16' styleClass='boldUnderline'/>
+ <JPasswordField id='password'/>
+ <JButton text="ok" actionIcon='ok_16' onActionPerformed='engine.connection()'/>
+ </JToolBar>
- <JSplitPane constraints='BorderLayout.CENTER' dividerLocation='200' >
- <JScrollPane>
- <JTree id='navigation'
- model='{new DefaultTreeModel(new DefaultMutableTreeNode("Empty"))}' />
- </JScrollPane>
- <JScrollPane >
- <JPanel layout='{new BorderLayout()}'>
- <JPanel id='tableName' constraints='BorderLayout.NORTH'/>
- <JPanel id='tableContent' constraints='BorderLayout.CENTER'/>
- <JPanel id='tableTips' constraints='BorderLayout.SOUTH'/>
- </JPanel>
- </JScrollPane>
- </JSplitPane>
+ <JSplitPane constraints='BorderLayout.CENTER' dividerLocation='200' >
+ <JScrollPane>
+ <JTree id='navigation'
+ model='{new DefaultTreeModel(new DefaultMutableTreeNode(n_("Empty")))}' />
+ </JScrollPane>
+ <JScrollPane>
+ <JPanel layout='{new BorderLayout()}'>
+ <JPanel id='tableName' constraints='BorderLayout.NORTH'/>
+ <JPanel id='tableContent' constraints='BorderLayout.CENTER'/>
+ <JPanel id='tableTips' constraints='BorderLayout.SOUTH'/>
+ </JPanel>
+ </JScrollPane>
+ </JSplitPane>
+ </JPanel>
+ <JPanel id='messagesPanel' constraints='BorderLayout.SOUTH'/>
</JPanel>
- <JPanel id='messagesPanel' constraints='BorderLayout.SOUTH'/>
- </JPanel>
</Application>
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -1,5 +1,7 @@
package org.nuiton.mapstoragemanager.ui.gui;
+import java.awt.Desktop;
+import java.net.URL;
import java.util.Iterator;
import java.util.Locale;
import java.util.Properties;
@@ -10,12 +12,15 @@
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
+import jaxx.runtime.swing.ErrorDialogUI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.mapstoragemanager.Main;
+import org.nuiton.mapstoragemanager.MsmConfig;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
import org.nuiton.mapstoragemanager.ui.MainUI;
import static org.nuiton.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n._;
/**
* Engine Class with methods for application user interface.
@@ -26,7 +31,7 @@
/**
* Logger.
*/
- private static final Log LOG = LogFactory.getLog(ApplicationEngine.class);
+ private static final Log log = LogFactory.getLog(ApplicationEngine.class);
/**
* current Locale.
@@ -48,8 +53,6 @@
*/
private static ApplicationEngine instance = null;
- //public ImageIcon imgOk = new ImageIcon(getClass().getResource("ok.png"));
-
/**
* Constructor.
*/
@@ -68,7 +71,7 @@
ohm.put("table1", "column1", "1", "content1");
ohm.put("table1", "column1", "2", "content2");
- ohm.put("table1", "column2", "1", "content3");
+ ohm.put("table1", "column2", "3", "content3");
ohm.put("table1", "column2", "4", "content4");
ohm.put("table2", "column3", "5", "content1");
@@ -80,13 +83,6 @@
}
/**
- * Show the developers.
- */
- public final void showGreeting() {
- JOptionPane.showMessageDialog(null, "CODE LUTIN");
- }
-
- /**
* Method to close the application.
*/
public final void close() {
@@ -112,11 +108,42 @@
this.application = application;
}*/
+ /**
+ * Show toolBar in order to connect.
+ */
+ public void showToolBar(){
+ MainUI ui = MainUI.getInstance();
+ ui.getToolBar().setVisible(true);
+ }
+
+ /**
+ * Hide toolBar in order to disconnect.
+ */
+ public void disposeToolBar(){
+ MainUI ui = MainUI.getInstance();
+ ui.getToolBar().setVisible(false);
+ clean(ui);
+ }
+
+ /**
+ * Clean the application.
+ */
+ public void clean(MainUI ui){
+ ui.getNavigation().setVisible(false);
+ ui.getTableContent().setVisible(false);
+ ui.getTableName().setVisible(false);
+ ui.getTableTips().setVisible(false);
+ }
+
/**
* Try to connect the user to a database.
*/
public void connection(){
MainUI ui = MainUI.getInstance();
+
+ //update menu
+ ui.getMenuDisconnect().setEnabled(true);
+
String nameBase = ui.getNameBase().getSelectedJaxxItem().getValue().toString();
String login = ui.getLogin().getText();
char[] password = ui.getPassword().getPassword();
@@ -145,7 +172,7 @@
ui.getNavigation().revalidate();
}else{
//display error
- JOptionPane.showMessageDialog(null, n_("jaxxdemo.tree.component"));
+ JOptionPane.showMessageDialog(null, n_("connectionError"));
}
}
@@ -168,13 +195,66 @@
instance = null;
}
+ /**
+ * Show help.
+ */
+ public void showHelp() {
+ String message=n_("No help today, sorry !");
+ JOptionPane.showMessageDialog(null, message);
+ }
+ /**
+ * Redirection to site.
+ */
+ public void gotoSite() {
+ MainUI ui = MainUI.getInstance();
+ MsmConfig config = ui.getConfig();
+
+ URL siteURL = config.getOptionAsURL("application.site.url");
+
+ log.info(_("jaxxdemo.message.goto.site", siteURL));
+
+ if (log.isDebugEnabled()) {
+ log.debug("goto " + siteURL);
+ }
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
+ try {
+ Desktop.getDesktop().browse(siteURL.toURI());
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
+ ErrorDialogUI.showError(ex);
+ }
+ }
+ }
+
+ /**
+ * Informations about team.
+ */
+ public void showAbout() {
+ String message="Developers :"+"\n";
+ message+=" Gilles Crieloue"+"\n";
+ message+=" Amaury Fages"+"\n";
+ message+=" Florent Gilet"+"\n";
+ message+=" Langlais Dorian"+"\n";
+ message+="Version 1.0 Codelutin @ 2009-2010";
+ JOptionPane.showMessageDialog(null, message);
+ }
+
+
//GETTERS AND SETTERS
+ /**
+ *
+ * @return
+ */
public OurHashMap2 getOurHashMap(){
return ohm;
}
+ /**
+ *
+ * @param ohm
+ */
public void setOurHashMap(OurHashMap2 ohm){
this.ohm = ohm;
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -5,9 +5,14 @@
package org.nuiton.mapstoragemanager.ui.gui;
+import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Dimension;
import javax.swing.JLabel;
+import javax.swing.JScrollPane;
import javax.swing.JTable;
+import javax.swing.ScrollPaneLayout;
+import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.table.TableColumn;
@@ -22,9 +27,11 @@
@Override
public void valueChanged(TreeSelectionEvent e) {
- DefaultMutableTreeNode node = (DefaultMutableTreeNode)MainUI.getInstance().getNavigation().getLastSelectedPathComponent();
- MainUI.getInstance().getTableContent().removeAll();
- MainUI.getInstance().getTableName().removeAll();
+ MainUI ui = MainUI.getInstance();
+
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode)ui.getNavigation().getLastSelectedPathComponent();
+ ui.getTableContent().removeAll();
+ ui.getTableName().removeAll();
/* if nothing is selected */
if (node == null || node.isRoot()) {
@@ -34,16 +41,19 @@
TableModel model = new TableModel(node);
JTable jTable = new JTable(model);
+ JScrollPane scrollPane = new JScrollPane(jTable);
+ jTable.setFillsViewportHeight(true);
+
//we check attributes and values of the select table
//and display the result into the JPanel named 'tableContent'
- MainUI.getInstance().getTableContent().add(jTable);
+ ui.getTableContent().add(scrollPane);
}
- MainUI.getInstance().getTableName().add(new JLabel("<html><b><u>"+node.toString()+"</b></u></html>"));
- MainUI.getInstance().getTableContent().repaint();
- MainUI.getInstance().getTableContent().revalidate();
+ ui.getTableName().add(new JLabel("<html><b><u>"+node.toString()+"</b></u></html>"));
+ ui.getTableContent().repaint();
+ ui.getTableContent().revalidate();
}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/TableModel.java 2010-02-27 00:45:14 UTC (rev 132)
@@ -39,33 +39,28 @@
titres = new String[set.size()];
//content
+ Set<String> keySetTable = testHashmap2.getKeys(table);
Iterator i = set.iterator();
int j=0;
int k=0;
+ System.out.println("set.size() : "+set.size()+" | keySet.size() : "+keySetTable.size());
+ data = new String[set.size()][keySetTable.size()];
while(i.hasNext()){
String titreTemp = (String)i.next();
titres[j]=titreTemp;
- //content of data
- Set<String> keySet = testHashmap2.getKeys(table,titres[j]);
+ Set<String> keySet = testHashmap2.getKeys(table,titres[j]);
Iterator i2 = keySet.iterator();
-
- System.out.println(set.size()+" | "+keySet.size());
- if(j==0){
- data = new String[set.size()][keySet.size()];
- }
while(i2.hasNext()){
+ System.out.println("table = "+table);
+ System.out.println("titreTemp = "+titreTemp);
String str = testHashmap2.get(table,titreTemp,(String)i2.next());
data[j][k]=str;
System.out.println("data["+j+"]["+k+"] = "+data[j][k]);
k++;
- };
+ }
j++;
- k=0;
}
-
-
-
}
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-27 00:45:14 UTC (rev 132)
@@ -1,9 +1,10 @@
+Empty=
Map\ Storage\ Manager=Map Storage Manager
-TABLE\ NAME\ \:\ TODO=
+No\ help\ today,\ sorry\ \!=No help today, sorry \!
connectionError=The connection attempt to failed, please retry \!
+jaxxdemo.message.goto.site=Visit site
jaxxdemo.tree.component=
login\ \:=Login
-map\ Storage\ Manager=
mapstoragemanager.action.aboutUs=About us
mapstoragemanager.action.aboutUs.tip=About Code Lutin
mapstoragemanager.action.connect=Connect
Modified: trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-27 00:45:14 UTC (rev 132)
@@ -1,9 +1,10 @@
+Empty=Vide
Map\ Storage\ Manager=Map Storage Manager
-TABLE\ NAME\ \:\ TODO=
+No\ help\ today,\ sorry\ \!=Pas d'aide pour l'instant, d\u00E9sol\u00E9 \!
connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
+jaxxdemo.message.goto.site=Visitez le site
jaxxdemo.tree.component=
login\ \:=Identifiant
-map\ Storage\ Manager=
mapstoragemanager.action.aboutUs=A propos
mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
mapstoragemanager.action.connect=Connexion
Added: trunk/msm/src/main/resources/icons/action-connect.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-connect.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-disconnect.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-disconnect.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/msm/src/main/resources/msm.properties
===================================================================
--- trunk/msm/src/main/resources/msm.properties 2010-02-26 14:37:51 UTC (rev 131)
+++ trunk/msm/src/main/resources/msm.properties 2010-02-27 00:45:14 UTC (rev 132)
@@ -11,4 +11,7 @@
icon.action.exit=action-exit.png
icon.action.config=action-config.png
icon.action.i18n-fr=action-i18n-fr.png
-icon.action.i18n-uk=action-i18n-uk.png
\ No newline at end of file
+icon.action.i18n-uk=action-i18n-uk.png
+icon.action.connect=action-connect.png
+icon.action.disconnect=action-disconnect.png
+application.site.url=http\://www.nuiton.org/projects/show/mapstoragemanager
\ No newline at end of file
1
0
Feb. 26, 2010
Author: dlanglais
Date: 2010-02-26 15:37:51 +0100 (Fri, 26 Feb 2010)
New Revision: 131
Added:
trunk/src/site/doc/analyse/importexport/
trunk/src/site/doc/analyse/importexport/example1.dtd
trunk/src/site/doc/analyse/importexport/example1.xml
trunk/src/site/doc/analyse/importexport/example2.dtd
trunk/src/site/doc/analyse/importexport/example2.xml
Log:
Ajout de deux exemples de format d'import/export de contenu de bases. Tr?\195?\168s basique.
Pr?\195?\169f?\195?\169rence pour example2.
Added: trunk/src/site/doc/analyse/importexport/example1.dtd
===================================================================
--- trunk/src/site/doc/analyse/importexport/example1.dtd (rev 0)
+++ trunk/src/site/doc/analyse/importexport/example1.dtd 2010-02-26 14:37:51 UTC (rev 131)
@@ -0,0 +1,33 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ TODO define vocabulary identification
+ PUBLIC ID: -//vendor//vocabulary//EN
+ SYSTEM ID: http://server/path/example1.dtd
+
+-->
+
+<!--
+ An example how to use this DTD from your XML document:
+
+ <?xml version="1.0"?>
+
+ <!DOCTYPE root SYSTEM "example1.dtd">
+
+ <root>
+ ...
+ </root>
+-->
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT root (element)*>
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT element EMPTY>
+<!ATTLIST element
+ value CDATA #IMPLIED
+ version CDATA #IMPLIED
+ key CDATA #IMPLIED
+ column CDATA #IMPLIED
+ table CDATA #IMPLIED
+ >
Added: trunk/src/site/doc/analyse/importexport/example1.xml
===================================================================
--- trunk/src/site/doc/analyse/importexport/example1.xml (rev 0)
+++ trunk/src/site/doc/analyse/importexport/example1.xml 2010-02-26 14:37:51 UTC (rev 131)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Document : export.xml
+ Created on : 26 février 2010, 15:10
+ Author : Dorian Langlais
+ Description:
+ An example of format to export hbase content
+-->
+
+<root>
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="1" value="bla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="2" value="blabla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="3" value="bla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="1" version="4" value="bla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="2" version="1" value="blablablablablabla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="2" version="2" value="blabla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="3" version="1" value="bla" />
+ <element table="myLittleHBaseTable" column="myLittleFamily" key="4" version="1" value="bla" />
+</root>
Added: trunk/src/site/doc/analyse/importexport/example2.dtd
===================================================================
--- trunk/src/site/doc/analyse/importexport/example2.dtd (rev 0)
+++ trunk/src/site/doc/analyse/importexport/example2.dtd 2010-02-26 14:37:51 UTC (rev 131)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<!--
+ TODO define vocabulary identification
+ PUBLIC ID: -//vendor//vocabulary//EN
+ SYSTEM ID: http://server/path/example2.dtd
+
+-->
+
+<!--
+ An example how to use this DTD from your XML document:
+
+ <?xml version="1.0"?>
+
+ <!DOCTYPE root SYSTEM "example2.dtd">
+
+ <root>
+ ...
+ </root>
+-->
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT root (table)*>
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT table (column)*>
+<!ATTLIST table
+ tableName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT column (cell)*>
+<!ATTLIST column
+ columnName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT cell (value)*>
+<!ATTLIST cell
+ key CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT value (#PCDATA)>
+<!ATTLIST value
+ version CDATA #IMPLIED
+ >
Added: trunk/src/site/doc/analyse/importexport/example2.xml
===================================================================
--- trunk/src/site/doc/analyse/importexport/example2.xml (rev 0)
+++ trunk/src/site/doc/analyse/importexport/example2.xml 2010-02-26 14:37:51 UTC (rev 131)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Document : export2.xml.xml
+ Created on : 26 février 2010, 15:19
+ Author : Dorian Langlais
+ Description:
+ An other example of format to export hbase content
+-->
+
+<root>
+ <table tableName="myLittleHBaseTable">
+ <column columnName="myLittleFamily">
+ <cell key="1">
+ <value version="1">bla</value>
+ <value version="2">blabla</value>
+ <value version="3">bla</value>
+ <value version="4">bla</value>
+ </cell>
+ <cell key="2">
+ <value version="1">blablablablablabla</value>
+ <value version="2">blabla</value>
+ </cell>
+ <cell key="3">
+ <value version="1">bla</value>
+ </cell>
+ <cell key="4">
+ <value version="1">bla</value>
+ </cell>
+ </column>
+ </table>
+</root>
1
0
r130 - in trunk: msm msm/src/main/java/org/nuiton/mapstoragemanager/plugins msm-bighashmap msm-bighashmapV2 msm-hbase
by dlanglais@users.nuiton.org Feb. 26, 2010
by dlanglais@users.nuiton.org Feb. 26, 2010
Feb. 26, 2010
Author: dlanglais
Date: 2010-02-26 05:49:19 +0100 (Fri, 26 Feb 2010)
New Revision: 130
Added:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Exporter.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Importer.java
Modified:
trunk/msm-bighashmap/pom.xml
trunk/msm-bighashmapV2/pom.xml
trunk/msm-hbase/pom.xml
trunk/msm/pom.xml
Log:
Modifications mineures des pom (ajout groupId nuiton.org ?\195?\160 ceux qui ne l'avait pas).
Ajout de deux interfaces pour des plugins d'import/export :
-> permettra l'import/export en suivant des "sch?\195?\169mas" diff?\195?\169rents.
Modified: trunk/msm/pom.xml
===================================================================
--- trunk/msm/pom.xml 2010-02-25 16:28:09 UTC (rev 129)
+++ trunk/msm/pom.xml 2010-02-26 04:49:19 UTC (rev 130)
@@ -14,9 +14,9 @@
<version>0.1-SNAPSHOT</version>
</parent>
- <!--version>0.1-SNAPSHOT</version-->
<groupId>org.nuiton</groupId>
<artifactId>msm</artifactId>
+ <version>0.1-SNAPSHOT</version>
<dependencies>
Added: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Exporter.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Exporter.java (rev 0)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Exporter.java 2010-02-26 04:49:19 UTC (rev 130)
@@ -0,0 +1,17 @@
+package org.nuiton.mapstoragemanager.plugins;
+
+import java.io.File;
+
+/**
+ * The interface for the exporter implementations.
+ * @author Dorian Langlais
+ */
+public interface Exporter {
+
+ /**
+ * Export the content of a "bigTable" in a file.
+ * @param bigTable the bigTable plugin.
+ * @param file the file in which export the content of the base.
+ */
+ void exportTo (final NewBigTable bigTable, final File file);
+}
\ No newline at end of file
Added: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Importer.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Importer.java (rev 0)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Importer.java 2010-02-26 04:49:19 UTC (rev 130)
@@ -0,0 +1,17 @@
+package org.nuiton.mapstoragemanager.plugins;
+
+import java.io.File;
+
+/**
+ * The interface for the importer implementations.
+ * @author Dorian Langlais
+ */
+public interface Importer {
+
+ /**
+ * Import the content of a file in a "bigTable".
+ * @param bigTable the bigTable plugin.
+ * @param file the file in which export the content of the base.
+ */
+ void importFrom (final NewBigTable bigTable, final File file);
+}
\ No newline at end of file
Modified: trunk/msm-bighashmap/pom.xml
===================================================================
--- trunk/msm-bighashmap/pom.xml 2010-02-25 16:28:09 UTC (rev 129)
+++ trunk/msm-bighashmap/pom.xml 2010-02-26 04:49:19 UTC (rev 130)
@@ -22,8 +22,9 @@
<version>0.1-SNAPSHOT</version>
</parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm-bighashmap</artifactId>
<version>0.1-SNAPSHOT</version>
- <artifactId>msm-bighashmap</artifactId>
<dependencies>
Modified: trunk/msm-bighashmapV2/pom.xml
===================================================================
--- trunk/msm-bighashmapV2/pom.xml 2010-02-25 16:28:09 UTC (rev 129)
+++ trunk/msm-bighashmapV2/pom.xml 2010-02-26 04:49:19 UTC (rev 130)
@@ -22,8 +22,9 @@
<version>0.1-SNAPSHOT</version>
</parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm-bighashmapv2</artifactId>
<version>0.1-SNAPSHOT</version>
- <artifactId>msm-bighashmapv2</artifactId>
<dependencies>
Modified: trunk/msm-hbase/pom.xml
===================================================================
--- trunk/msm-hbase/pom.xml 2010-02-25 16:28:09 UTC (rev 129)
+++ trunk/msm-hbase/pom.xml 2010-02-26 04:49:19 UTC (rev 130)
@@ -35,8 +35,9 @@
<version>0.1-SNAPSHOT</version>
</parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>msm-hbase</artifactId>
<version>0.1-SNAPSHOT</version>
- <artifactId>msm-hbase</artifactId>
<dependencies>
1
0
r129 - in trunk/msm/src: main/java/org/nuiton/mapstoragemanager main/java/org/nuiton/mapstoragemanager/core main/java/org/nuiton/mapstoragemanager/ui main/java/org/nuiton/mapstoragemanager/ui/gui main/resources main/resources/i18n main/resources/icons test/java/org/nuiton/mapstoragemanager/core
by fgilet@users.nuiton.org Feb. 25, 2010
by fgilet@users.nuiton.org Feb. 25, 2010
Feb. 25, 2010
Author: fgilet
Date: 2010-02-25 17:28:09 +0100 (Thu, 25 Feb 2010)
New Revision: 129
Added:
trunk/msm/src/main/resources/icons/action-about.png
trunk/msm/src/main/resources/icons/action-config.png
trunk/msm/src/main/resources/icons/action-exit.png
trunk/msm/src/main/resources/icons/action-help.png
trunk/msm/src/main/resources/icons/action-i18n-fr.png
trunk/msm/src/main/resources/icons/action-i18n-uk.png
trunk/msm/src/main/resources/icons/action-site.png
trunk/msm/src/main/resources/icons/cancel_16.png
trunk/msm/src/main/resources/icons/cancel_32.png
trunk/msm/src/main/resources/icons/database_16.png
trunk/msm/src/main/resources/icons/database_32.png
trunk/msm/src/main/resources/icons/login_16.png
trunk/msm/src/main/resources/icons/login_32.png
trunk/msm/src/main/resources/icons/ok_16.png
trunk/msm/src/main/resources/icons/ok_32.png
trunk/msm/src/main/resources/icons/password_16.png
trunk/msm/src/main/resources/icons/password_32.png
trunk/msm/src/main/resources/icons/warning_16.png
trunk/msm/src/main/resources/icons/warning_32.png
trunk/msm/src/main/resources/messages.properties
trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/TestServiceLoader.java
Removed:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/messages.properties
trunk/msm/src/main/resources/icons/ok.png
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
trunk/msm/src/main/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
trunk/msm/src/main/resources/msm.properties
Log:
Internationalisation fonctionelle.
Am?\195?\169lioration graphique:
-ajout d'images aux boutons, labels
-meilleurs espacements
-cr?\195?\169ation d'un panel message
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/Main.java 2010-02-25 16:28:09 UTC (rev 129)
@@ -10,7 +10,7 @@
import javax.swing.*;
import java.util.Locale;
-import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
/**
* Created: 21 janv. 2010
@@ -28,7 +28,7 @@
*/
private static Log log = LogFactory.getLog(Main.class);
- Locale locale = Locale.FRANCE;
+ public static Locale locale = Locale.FRANCE;
private Main(String... args){
try{
@@ -55,8 +55,8 @@
@Override
public void run() {
-
ui.setVisible(true);
+ init();
}
});
@@ -69,7 +69,27 @@
public static void main(String... args) {
new Main(args);
+
}
+ public static void setLocale(Locale locale){
+ Main.locale = locale;
+ MainUI.getInstance().dispose();
+ Main.main();
+ }
+ private void init() {
+ MainUI ui = MainUI.getInstance();
+ Locale locale = Main.locale;
+ if (locale.equals(Locale.FRANCE)){
+ ui.getMenuFileLanguageFR().setEnabled(false);
+ } else if (locale.equals(Locale.UK)){
+ ui.getMenuFileLanguageUK().setEnabled(false);
+ }
+ String message = n_("messageEntry");
+ ui.displayMessage(message, 1);
+
+
+ }
+
}
Deleted: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/messages.properties
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/messages.properties 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/messages.properties 2010-02-25 16:28:09 UTC (rev 129)
@@ -1 +0,0 @@
-Config.url=plugins/
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-02-25 16:28:09 UTC (rev 129)
@@ -50,12 +50,14 @@
#menuExit {
text:"mapstoragemanager.action.exit";
toolTipText:"mapstoragemanager.action.exit.tip";
+ actionIcon:"exit";
mnemonic:E;
}
#menuPreferences {
text:"mapstoragemanager.action.preferences";
toolTipText:"mapstoragemanager.action.preferences.tip";
+ actionIcon:"config";
mnemonic:P;
}
@@ -68,18 +70,21 @@
#menuHelpHelp {
text:"mapstoragemanager.action.help";
toolTipText:"mapstoragemanager.action.help.tip";
+ actionIcon:"help";
mnemonic:E;
}
#menuHelpSite {
text:"mapstoragemanager.action.visitSite";
toolTipText:"mapstoragemanager.action.visitSite.tip";
+ actionIcon:"site";
mnemonic:V;
}
#menuHelpAbout {
text:"mapstoragemanager.action.aboutUs";
toolTipText:"mapstoragemanager.action.aboutUs.tip";
+ actionIcon:"about";
mnemonic:A;
}
@@ -87,12 +92,14 @@
#menuFileLanguageFR {
text:"mapstoragemanager.action.fr";
toolTipText:"mapstoragemanager.action.fr.tip";
+ actionIcon:"i18n-fr";
mnemonic:F;
}
#menuFileLanguageUK {
text:"mapstoragemanager.action.uk";
toolTipText:"mapstoragemanager.action.uk.tip";
+ actionIcon:"i18n-uk";
mnemonic:U;
}
@@ -108,7 +115,7 @@
}
JLabel.boldUnderline {
- font-weight: bold;
+ font-weight: bold;
}
JSplitPane {
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.jaxx 2010-02-25 16:28:09 UTC (rev 129)
@@ -7,6 +7,7 @@
import org.nuiton.mapstoragemanager.ui.gui.ApplicationEngine;
import javax.swing.tree.*;
import static org.nuiton.i18n.I18n.n_;
+ import javax.swing.JLabel;
ApplicationEngine engine = ApplicationEngine.getInstance();
@@ -34,14 +35,44 @@
return engine;
}
+ /**
+ * Dispose UI.
+ */
+ public void dispose(){
+ instance = null;
+ engine.dispose();
+ this.setVisible(false);
+ }
+ /**
+ * Display the appropriate message.
+ * @param message the message to display.
+ * @param code code error (for images).
+ */
+ public void displayMessage(String message, int code){
+ this.getMessagesPanel().removeAll();
+ JLabel label = new JLabel(message);
+ /*
+ if (code==0){
+ ImageIcon = new ImageIcon("ok_16.png");
+ }else if (code==1){
+ ImageIcon = new ImageIcon("warning_16.png");
+ }else if (code==2){
+ ImageIcon = new ImageIcon("cancel_16.png");
+ }
+ */
+ //label.setIcon(icon);
+ this.getMessagesPanel().add(label);
+ }
+
+
]]>
</script>
<!-- style definition -->
<style source='MainUI.css'/>
- <!-- content -->
+ <!-- content -->
<JMenuBar>
<JMenu id='menuFile'>
@@ -61,9 +92,9 @@
<JSeparator/>
<JMenu id='menuLanguage'>
<JMenuItem id='menuFileLanguageFR'
+ onActionPerformed='engine.setLocale("fr","FR")'/>
+ <JMenuItem id='menuFileLanguageUK'
onActionPerformed='engine.setLocale("en","GB")'/>
- <JMenuItem id='menuFileLanguageUK'
- onActionPerformed='engine.setLocale("fr","FR")'/>
</JMenu>
</JMenu>
@@ -78,31 +109,27 @@
</JMenuBar>
- <!-- images
- <javax.swing.ImageIcon id='valid' constructorParams='getClass().getResource("ok.png")'/>
- -->
-
+ <JPanel layout='{new BorderLayout()}' constraints='BorderLayout.CENTER'>
<JPanel layout='{new BorderLayout()}' id='mainPanel'>
<JToolBar constraints='BorderLayout.NORTH' opaque='true'>
- <JLabel text="name base :" styleClass='boldUnderline' />
+ <JLabel text="name base :" actionIcon='database_16' styleClass='boldUnderline' />
<JAXXComboBox id='nameBase' onActionPerformed='engine.doSomething()' >
<item value='OurHashMap' selected='true'/>
<item value='HBase'/>
<item value='Cassandra'/>
<item value='Other'/>
</JAXXComboBox>
- <JLabel text="login :" styleClass='boldUnderline'/>
+ <JLabel text="login :" actionIcon='login_16' styleClass='boldUnderline'/>
<JTextField id='login'/>
- <JLabel text="password :" styleClass='boldUnderline'/>
+ <JLabel text="password :" actionIcon='password_16' styleClass='boldUnderline'/>
<JPasswordField id='password'/>
- <!-- <JButton text="ok" onActionPerformed='engine.connection()'/> -->
- <JButton text="ok" actionIcon='ok' onActionPerformed='engine.connection()'/>
+ <JButton text="ok" actionIcon='ok_16' onActionPerformed='engine.connection()'/>
</JToolBar>
<JSplitPane constraints='BorderLayout.CENTER' dividerLocation='200' >
<JScrollPane>
<JTree id='navigation'
- model='{new DefaultTreeModel(new DefaultMutableTreeNode(n_("welcome.MapStorageManager")))}' />
+ model='{new DefaultTreeModel(new DefaultMutableTreeNode("Empty"))}' />
</JScrollPane>
<JScrollPane >
<JPanel layout='{new BorderLayout()}'>
@@ -110,8 +137,10 @@
<JPanel id='tableContent' constraints='BorderLayout.CENTER'/>
<JPanel id='tableTips' constraints='BorderLayout.SOUTH'/>
</JPanel>
- </JScrollPane>
+ </JScrollPane>
</JSplitPane>
</JPanel>
+ <JPanel id='messagesPanel' constraints='BorderLayout.SOUTH'/>
+ </JPanel>
</Application>
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-02-25 16:28:09 UTC (rev 129)
@@ -5,12 +5,14 @@
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.mapstoragemanager.plugins.OurHashMap;
+import org.nuiton.mapstoragemanager.Main;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
import org.nuiton.mapstoragemanager.ui.MainUI;
import static org.nuiton.i18n.I18n.n_;
@@ -46,12 +48,13 @@
*/
private static ApplicationEngine instance = null;
+ //public ImageIcon imgOk = new ImageIcon(getClass().getResource("ok.png"));
-
/**
* Constructor.
*/
private ApplicationEngine(){
+
ohm = new OurHashMap2();
ohm.createTable("table1");
ohm.createTable("table2");
@@ -101,13 +104,8 @@
* @param country the country
*/
public void setLocale(String language, String country) {
- /*Locale locale = new Locale(language,country);
- System.out.println("local en "+language+"_"+country);
- I18n.close();
- I18n.setUniqueBundleName("mapstoragemanager-i18n");
- I18n.init(locale);
- final MainUI ui = new MainUI();
- ui.setVisible(true);*/
+ Locale locale = new Locale(language,country);
+ Main.setLocale(locale);
}
/*public void setMainUI(MainUI application) {
@@ -118,9 +116,10 @@
* Try to connect the user to a database.
*/
public void connection(){
- String nameBase = MainUI.getInstance().getNameBase().getSelectedJaxxItem().getValue().toString();
- String login = MainUI.getInstance().getLogin().getText();
- char[] password = MainUI.getInstance().getPassword().getPassword();
+ MainUI ui = MainUI.getInstance();
+ String nameBase = ui.getNameBase().getSelectedJaxxItem().getValue().toString();
+ String login = ui.getLogin().getText();
+ char[] password = ui.getPassword().getPassword();
//connection verification
boolean goodUse = true;
@@ -128,11 +127,11 @@
if(goodUse){
//update tree
- MainUI.getInstance().getNavigation().setModel(new MSMModel(nameBase));
- MainUI.getInstance().getNavigation().addTreeSelectionListener(new MSMNavigationListener());
+ ui.getNavigation().setModel(new MSMModel(nameBase));
+ ui.getNavigation().addTreeSelectionListener(new MSMNavigationListener());
- DefaultMutableTreeNode root = (DefaultMutableTreeNode) MainUI.getInstance().getNavigation().getModel().getRoot();
- DefaultTreeModel dtm = ((DefaultTreeModel) MainUI.getInstance().getNavigation().getModel());
+ DefaultMutableTreeNode root = (DefaultMutableTreeNode) ui.getNavigation().getModel().getRoot();
+ DefaultTreeModel dtm = ((DefaultTreeModel) ui.getNavigation().getModel());
Set<String> tableNames = ohm.getTablesNames();
@@ -142,11 +141,11 @@
dtm.insertNodeInto(new DefaultMutableTreeNode(tableName), root, root.getChildCount());
}
- MainUI.getInstance().getNavigation().repaint();
- MainUI.getInstance().getNavigation().revalidate();
+ ui.getNavigation().repaint();
+ ui.getNavigation().revalidate();
}else{
//display error
- JOptionPane.showMessageDialog(null, n_("connectionError"));
+ JOptionPane.showMessageDialog(null, n_("jaxxdemo.tree.component"));
}
}
@@ -162,6 +161,14 @@
return instance;
}
+ /**
+ * Dispose engine.
+ */
+ public void dispose(){
+ instance = null;
+ }
+
+
//GETTERS AND SETTERS
public OurHashMap2 getOurHashMap(){
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-02-25 16:28:09 UTC (rev 129)
@@ -1,35 +1,37 @@
-Map\ Storage\ Manager=Map Storage Manager
-TABLE\ NAME\ \:\ TODO=
-connectionError=The connection attempt to failed, please retry \!
-login\ \:=Login
-map\ Storage\ Manager=
-mapstoragemanager.action.aboutUs=About us
-mapstoragemanager.action.aboutUs.tip=About Code Lutin
-mapstoragemanager.action.connect=Connect
-mapstoragemanager.action.connect.tip=Start a new connection
-mapstoragemanager.action.disconnect=Disconnect
-mapstoragemanager.action.disconnect.tip=Disconnect the current session
-mapstoragemanager.action.edit=Edit
-mapstoragemanager.action.edit.tip=
-mapstoragemanager.action.exit=Exit
-mapstoragemanager.action.exit.tip=
-mapstoragemanager.action.file=File
-mapstoragemanager.action.file.tip=
-mapstoragemanager.action.fr=French
-mapstoragemanager.action.fr.tip=Change to french language
-mapstoragemanager.action.help=Help
-mapstoragemanager.action.help.tip=
-mapstoragemanager.action.language=Choose language
-mapstoragemanager.action.language.tip=
-mapstoragemanager.action.menuHelp=Help
-mapstoragemanager.action.menuHelp.tip=
-mapstoragemanager.action.preferences=Preferences
-mapstoragemanager.action.preferences.tip=
-mapstoragemanager.action.uk=English
-mapstoragemanager.action.uk.tip=Change to english language
-mapstoragemanager.action.visitSite=Visit our site
-mapstoragemanager.action.visitSite.tip=
-name\ base\ \:=Name base
-ok=Validate
-password\ \:=Password
-welcome.MapStorageManager=Welcome to MapStorageManager
+Map\ Storage\ Manager=Map Storage Manager
+TABLE\ NAME\ \:\ TODO=
+connectionError=The connection attempt to failed, please retry \!
+jaxxdemo.tree.component=
+login\ \:=Login
+map\ Storage\ Manager=
+mapstoragemanager.action.aboutUs=About us
+mapstoragemanager.action.aboutUs.tip=About Code Lutin
+mapstoragemanager.action.connect=Connect
+mapstoragemanager.action.connect.tip=Start a new connection
+mapstoragemanager.action.disconnect=Disconnect
+mapstoragemanager.action.disconnect.tip=Disconnect the current session
+mapstoragemanager.action.edit=Edit
+mapstoragemanager.action.edit.tip=
+mapstoragemanager.action.exit=Exit
+mapstoragemanager.action.exit.tip=
+mapstoragemanager.action.file=File
+mapstoragemanager.action.file.tip=
+mapstoragemanager.action.fr=French
+mapstoragemanager.action.fr.tip=Change to french language
+mapstoragemanager.action.help=Help
+mapstoragemanager.action.help.tip=
+mapstoragemanager.action.language=Choose language
+mapstoragemanager.action.language.tip=
+mapstoragemanager.action.menuHelp=Help
+mapstoragemanager.action.menuHelp.tip=
+mapstoragemanager.action.preferences=Preferences
+mapstoragemanager.action.preferences.tip=
+mapstoragemanager.action.uk=English
+mapstoragemanager.action.uk.tip=Change to english language
+mapstoragemanager.action.visitSite=Visit our site
+mapstoragemanager.action.visitSite.tip=
+messageEntry=Welcome to MapStorageManager
+name\ base\ \:=Name base
+ok=Validate
+password\ \:=Password
+welcome.MapStorageManager=Welcome to MapStorageManager
Modified: trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-02-25 16:28:09 UTC (rev 129)
@@ -1,35 +1,37 @@
-Map\ Storage\ Manager=Map Storage Manager
-TABLE\ NAME\ \:\ TODO=
-connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
-login\ \:=Identifiant
-map\ Storage\ Manager=
-mapstoragemanager.action.aboutUs=A propos
-mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
-mapstoragemanager.action.connect=Connexion
-mapstoragemanager.action.connect.tip=Etablis une nouvelle connexion
-mapstoragemanager.action.disconnect=D\u00E9connexion
-mapstoragemanager.action.disconnect.tip=D\u00E9connecte la session courante
-mapstoragemanager.action.edit=Edition
-mapstoragemanager.action.edit.tip=
-mapstoragemanager.action.exit=Quitter
-mapstoragemanager.action.exit.tip=Quitte l'application
-mapstoragemanager.action.file=Fichier
-mapstoragemanager.action.file.tip=
-mapstoragemanager.action.fr=Fran\u00E7ais
-mapstoragemanager.action.fr.tip=Changer la langue en fran\u00E7ais
-mapstoragemanager.action.help=Aide
-mapstoragemanager.action.help.tip=
-mapstoragemanager.action.language=choisir la langue
-mapstoragemanager.action.language.tip=
-mapstoragemanager.action.menuHelp=Aide
-mapstoragemanager.action.menuHelp.tip=Aide contextuelle
-mapstoragemanager.action.preferences=Pr\u00E9f\u00E9rences
-mapstoragemanager.action.preferences.tip=Permet de configurer l'application
-mapstoragemanager.action.uk=Anglais
-mapstoragemanager.action.uk.tip=Changer la langue en anglais
-mapstoragemanager.action.visitSite=Visiter notre site
-mapstoragemanager.action.visitSite.tip=
-name\ base\ \:=Nom de la base
-ok=Valider
-password\ \:=Mot de passe
-welcome.MapStorageManager=Bienvenue dans MapStorageManager
+Map\ Storage\ Manager=Map Storage Manager
+TABLE\ NAME\ \:\ TODO=
+connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
+jaxxdemo.tree.component=
+login\ \:=Identifiant
+map\ Storage\ Manager=
+mapstoragemanager.action.aboutUs=A propos
+mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
+mapstoragemanager.action.connect=Connexion
+mapstoragemanager.action.connect.tip=Etablis une nouvelle connexion
+mapstoragemanager.action.disconnect=D\u00E9connexion
+mapstoragemanager.action.disconnect.tip=D\u00E9connecte la session courante
+mapstoragemanager.action.edit=Edition
+mapstoragemanager.action.edit.tip=
+mapstoragemanager.action.exit=Quitter
+mapstoragemanager.action.exit.tip=Quitte l'application
+mapstoragemanager.action.file=Fichier
+mapstoragemanager.action.file.tip=
+mapstoragemanager.action.fr=Fran\u00E7ais
+mapstoragemanager.action.fr.tip=Changer la langue en fran\u00E7ais
+mapstoragemanager.action.help=Aide
+mapstoragemanager.action.help.tip=
+mapstoragemanager.action.language=choisir la langue
+mapstoragemanager.action.language.tip=
+mapstoragemanager.action.menuHelp=Aide
+mapstoragemanager.action.menuHelp.tip=Aide contextuelle
+mapstoragemanager.action.preferences=Pr\u00E9f\u00E9rences
+mapstoragemanager.action.preferences.tip=Permet de configurer l'application
+mapstoragemanager.action.uk=Anglais
+mapstoragemanager.action.uk.tip=Changer la langue en anglais
+mapstoragemanager.action.visitSite=Visiter notre site
+mapstoragemanager.action.visitSite.tip=
+messageEntry=Bienvenue dans MapStorageManager
+name\ base\ \:=Nom de la base
+ok=Valider
+password\ \:=Mot de passe
+welcome.MapStorageManager=Bienvenue dans MapStorageManager
Added: trunk/msm/src/main/resources/icons/action-about.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-config.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-config.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-exit.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-exit.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-help.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-help.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-i18n-fr.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-i18n-fr.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-i18n-uk.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-i18n-uk.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/action-site.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/action-site.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/cancel_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/cancel_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/cancel_32.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/cancel_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/database_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/database_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/database_32.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/database_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/login_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/login_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/login_32.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/login_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: trunk/msm/src/main/resources/icons/ok.png
===================================================================
(Binary files differ)
Added: trunk/msm/src/main/resources/icons/ok_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/ok_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Copied: trunk/msm/src/main/resources/icons/ok_32.png (from rev 123, trunk/msm/src/main/resources/icons/ok.png)
===================================================================
(Binary files differ)
Added: trunk/msm/src/main/resources/icons/password_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/password_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/password_32.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/password_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/warning_16.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/warning_16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/msm/src/main/resources/icons/warning_32.png
===================================================================
(Binary files differ)
Property changes on: trunk/msm/src/main/resources/icons/warning_32.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Copied: trunk/msm/src/main/resources/messages.properties (from rev 123, trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/messages.properties)
===================================================================
--- trunk/msm/src/main/resources/messages.properties (rev 0)
+++ trunk/msm/src/main/resources/messages.properties 2010-02-25 16:28:09 UTC (rev 129)
@@ -0,0 +1 @@
+Config.url=plugins/
Modified: trunk/msm/src/main/resources/msm.properties
===================================================================
--- trunk/msm/src/main/resources/msm.properties 2010-02-25 16:01:41 UTC (rev 128)
+++ trunk/msm/src/main/resources/msm.properties 2010-02-25 16:28:09 UTC (rev 129)
@@ -1 +1,14 @@
-icon.action.ok=ok.png
\ No newline at end of file
+icon.action.ok_16=ok_16.png
+icon.action.ok_32=ok_32.png
+icon.action.database_16=database_16.png
+icon.action.database_32=database_32.png
+icon.action.login_16=login_16.png
+icon.action.login_32=login_32.png
+icon.action.password_16=password_16.png
+icon.action.about=action-about.png
+icon.action.help=action-help.png
+icon.action.site=action-site.png
+icon.action.exit=action-exit.png
+icon.action.config=action-config.png
+icon.action.i18n-fr=action-i18n-fr.png
+icon.action.i18n-uk=action-i18n-uk.png
\ No newline at end of file
Copied: trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/TestServiceLoader.java (from rev 123, trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/TestServiceLoader.java)
===================================================================
--- trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/TestServiceLoader.java (rev 0)
+++ trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/TestServiceLoader.java 2010-02-25 16:28:09 UTC (rev 129)
@@ -0,0 +1,36 @@
+package org.nuiton.mapstoragemanager.core;
+
+import java.net.MalformedURLException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.mapstoragemanager.core.BigTableLoader;
+
+/**
+ * @author fdesbois
+ * @deprecated Use org.nuiton.mapstoragemanager.core.BigTableLoaderText instead
+ */
+@Deprecated
+public final class TestServiceLoader {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(TestServiceLoader.class);
+
+ private TestServiceLoader() {
+ try {
+ BigTableLoader p =
+ new BigTableLoader("plugins", this.getClass().getClassLoader());
+ LOG.info(p.getBigTable());
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ //e.printStackTrace();
+ LOG.error(e.toString(),e);
+ }
+ }
+
+ public static void main(final String[] args) {
+
+ new TestServiceLoader();
+ }
+}
\ No newline at end of file
1
0
r128 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core
by gcrieloue@users.nuiton.org Feb. 25, 2010
by gcrieloue@users.nuiton.org Feb. 25, 2010
Feb. 25, 2010
Author: gcrieloue
Date: 2010-02-25 17:01:41 +0100 (Thu, 25 Feb 2010)
New Revision: 128
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/BigTableLoader.java
Log:
Ajout d'une map pour les plugins (nom du plugin - plugin)
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/BigTableLoader.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/BigTableLoader.java 2010-02-25 14:26:32 UTC (rev 127)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/BigTableLoader.java 2010-02-25 16:01:41 UTC (rev 128)
@@ -4,6 +4,8 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.ServiceLoader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -12,7 +14,7 @@
/**
* @author Crieloue Gilles
- *
+ * This class loads the BigTable implementations
*/
public class BigTableLoader extends URLClassLoader {
@@ -27,6 +29,11 @@
private ServiceLoader<BigTable> bigTableSetLoader;
/**
+ * Map Identifiant - BigTable implementation
+ */
+ private HashMap<String, BigTable> plugins = new HashMap<String, BigTable>();
+
+ /**
* Class constructor.
* @param pluginsFolderPath the plugins folder path
* @param classLoader the parent classloader
@@ -49,6 +56,17 @@
}
bigTableSetLoader = ServiceLoader.load(BigTable.class, this);
+
+ /**
+ * Identifiant for the plugin
+ */
+
+ //TODO: define better identifiants
+ int pluginNumber = 0;
+ for (BigTable bigTableImpl : bigTableSetLoader){
+ plugins.put("BigTable"+pluginNumber, bigTableImpl);
+ pluginNumber++;
+ }
}
/**
@@ -79,8 +97,26 @@
/**
* Returns the BigTable Set Loader.
* @return the BigTable Set Loader
+ * @deprecated Use {@link #getAllBigTable()}
*/
public final ServiceLoader<BigTable> getBigTableSetLoader() {
return bigTableSetLoader;
}
+
+ /**
+ * Returns a BigTable implementation according to an identifiant.
+ * @param id the identifiant
+ * @return the BigTable
+ */
+ public BigTable getBigTable(String id){
+ return plugins.get(id);
+ }
+
+ /**
+ * Returns all the BigTable implementations loaded.
+ * @return all the BigTable implementations loaded
+ */
+ public Collection<BigTable> getAllBigTable(){
+ return plugins.values();
+ }
}
1
0
r127 - in trunk/msm-hbase: . src/main/java/org/nuiton/mapstoragemanager/plugins/hbase src/site
by dlanglais@users.nuiton.org Feb. 25, 2010
by dlanglais@users.nuiton.org Feb. 25, 2010
Feb. 25, 2010
Author: dlanglais
Date: 2010-02-25 15:26:32 +0100 (Thu, 25 Feb 2010)
New Revision: 127
Added:
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java
trunk/msm-hbase/src/site/failedBuild_25.02.2010.txt
Modified:
trunk/msm-hbase/pom.xml
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseNewBigTable.java
Log:
tentative d'avancement sur le plugin HBase, je n'arrive pas ?\195?\160 lancer MyLittleHBaseClient <- classe trouv?\195?\169e sur le site de hbase, ainsi que la trace du build dans src/site/
Modified: trunk/msm-hbase/pom.xml
===================================================================
--- trunk/msm-hbase/pom.xml 2010-02-25 14:12:17 UTC (rev 126)
+++ trunk/msm-hbase/pom.xml 2010-02-25 14:26:32 UTC (rev 127)
@@ -9,6 +9,19 @@
<id>org.nuiton</id>
<url>http://maven.nuiton.org/release</url>
</repository>
+ <repository>
+ <id>sharengo-maven2-repository</id>
+ <name>Sharengo's repository</name>
+ <url>http://maven2.sharengo.org</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ <checksumPolicy>warn</checksumPolicy>
+ </releases>
+ </repository>
</repositories>
<modelVersion>4.0.0</modelVersion>
@@ -55,16 +68,56 @@
<!-- HBase -->
<dependency>
- <groupId>org.apache.mahout.hadoop</groupId>
- <artifactId>hadoop-core</artifactId>
- <version>0.20.1</version>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
</dependency>
-
<dependency>
- <groupId>org.apache.mahout.hbase</groupId>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop.zookeeper</groupId>
+ <artifactId>zookeeper</artifactId>
+ <version>r785019-hbase-1329</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hadoop</groupId>
+ <artifactId>hadoop</artifactId>
+ <version>0.20.0-plus4681-core</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hadoop</groupId>
<artifactId>hbase</artifactId>
<version>0.20.0</version>
+ <scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.hadoop</groupId>
+ <artifactId>hbase-test</artifactId>
+ <version>0.20.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hadoop</groupId>
+ <artifactId>hadoop-test</artifactId>
+ <version>0.20.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.8</version>
+ </dependency>
</dependencies>
<!-- ************************************************************* -->
@@ -147,7 +200,7 @@
<build>
<!--<plugins>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -215,3 +268,4 @@
+
Modified: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseNewBigTable.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseNewBigTable.java 2010-02-25 14:12:17 UTC (rev 126)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseNewBigTable.java 2010-02-25 14:26:32 UTC (rev 127)
@@ -90,6 +90,8 @@
*/
public void deleteTable(String table) {
try {
+ // to delete a table, we have to disable it.
+ hBaseAdmin.disableTable(table);
hBaseAdmin.deleteTable(table);
LOG.trace("table " + table + " deleted.");
} catch (IOException ex) {
Added: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java (rev 0)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/MyLittleHBaseClient.java 2010-02-25 14:26:32 UTC (rev 127)
@@ -0,0 +1,108 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
+
+
+// Class that has nothing but a main.
+// Does a Put, Get and a Scan against an hbase table.
+public class MyLittleHBaseClient {
+ public static void main(String[] args) throws IOException {
+ // You need a configuration object to tell the client where to connect.
+ // When you create a HBaseConfiguration, it reads in whatever you've set
+ // into your hbase-site.xml and in hbase-default.xml, as long as these can
+ // be found on the CLASSPATH
+ HBaseConfiguration config = new HBaseConfiguration();
+
+// HBaseAdmin hBaseAdmin = new HBaseAdmin(config);
+// {
+// HTableDescriptor hTableDescriptor = new HTableDescriptor("myLittleHBaseTable2");
+// HColumnDescriptor hColumnDescriptor = new HColumnDescriptor("myLittleRow2");
+// hTableDescriptor.addFamily(hColumnDescriptor);
+// hBaseAdmin.createTable(hTableDescriptor);
+// }
+// for (HTableDescriptor hTableDescriptor : hBaseAdmin.listTables()) {
+// System.out.println(hTableDescriptor.getNameAsString());
+// for (HColumnDescriptor hColumnDescriptor : hTableDescriptor.getColumnFamilies()) {
+// System.out.println("\t" + hColumnDescriptor.getNameAsString());
+// }
+// }
+
+ // This instantiates an HTable object that connects you to
+ // the "myLittleHBaseTable" table.
+ HTable table = new HTable(config, "myLittleHBaseTable");
+
+ // To add to a row, use Put. A Put constructor takes the name of the row
+ // you want to insert into as a byte array. In HBase, the Bytes class has
+ // utility for converting all kinds of java types to byte arrays. In the
+ // below, we are converting the String "myLittleRow" into a byte array to
+ // use as a row key for our update. Once you have a Put instance, you can
+ // adorn it by setting the names of columns you want to update on the row,
+ // the timestamp to use in your update, etc.If no timestamp, the server
+ // applies current time to the edits.
+ Put p = new Put(Bytes.toBytes("myLittleRow"));
+
+ // To set the value you'd like to update in the row 'myLittleRow', specify
+ // the column family, column qualifier, and value of the table cell you'd
+ // like to update. The column family must already exist in your table
+ // schema. The qualifier can be anything. All must be specified as byte
+ // arrays as hbase is all about byte arrays. Lets pretend the table
+ // 'myLittleHBaseTable' was created with a family 'myLittleFamily'.
+ p.add(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"),
+ Bytes.toBytes("Some Value"));
+
+ // Once you've adorned your Put instance with all the updates you want to
+ // make, to commit it do the following (The HTable#put method takes the
+ // Put instance you've been building and pushes the changes you made into
+ // hbase)
+ table.put(p);
+
+ // Now, to retrieve the data we just wrote. The values that come back are
+ // Result instances. Generally, a Result is an object that will package up
+ // the hbase return into the form you find most palatable.
+ Get g = new Get(Bytes.toBytes("myLittleRow"));
+ Result r = table.get(g);
+ byte [] value = r.getValue(Bytes.toBytes("myLittleFamily"),
+ Bytes.toBytes("someQualifier"));
+ // If we convert the value bytes, we should get back 'Some Value', the
+ // value we inserted at this location.
+ String valueStr = Bytes.toString(value);
+ System.out.println("GET: " + valueStr);
+
+ // Sometimes, you won't know the row you're looking for. In this case, you
+ // use a Scanner. This will give you cursor-like interface to the contents
+ // of the table. To set up a Scanner, do like you did above making a Put
+ // and a Get, create a Scan. Adorn it with column names, etc.
+ Scan s = new Scan();
+ s.addColumn(Bytes.toBytes("myLittleFamily"), Bytes.toBytes("someQualifier"));
+ ResultScanner scanner = table.getScanner(s);
+ try {
+ // Scanners return Result instances.
+ // Now, for the actual iteration. One way is to use a while loop like so:
+ for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
+ // print out the row we found and the columns we were looking for
+ System.out.println("Found row: " + rr);
+ }
+
+ // The other approach is to use a foreach loop. Scanners are iterable!
+ // for (Result rr : scanner) {
+ // System.out.println("Found row: " + rr);
+ // }
+ } finally {
+ // Make sure you close your scanners when you are done!
+ // Thats why we have it inside a try/finally clause
+ scanner.close();
+ }
+ }
+}
Added: trunk/msm-hbase/src/site/failedBuild_25.02.2010.txt
===================================================================
--- trunk/msm-hbase/src/site/failedBuild_25.02.2010.txt (rev 0)
+++ trunk/msm-hbase/src/site/failedBuild_25.02.2010.txt 2010-02-25 14:26:32 UTC (rev 127)
@@ -0,0 +1,67 @@
+NetBeans: Executing 'mvn -Dexec.classpathScope=runtime -Dexec.args=-classpath %classpath org.nuiton.mapstoragemanager.plugins.hbase.MyLittleHBaseClient -Dexec.executable=/usr/java/jdk1.6.0_18/bin/java -Dnetbeans.execution=true process-classes org.codehaus.mojo:exec-maven-plugin:1.1.1:exec'
+NetBeans: JAVA_HOME=/usr/java/jdk1.6.0_18
+Scanning for projects...
+------------------------------------------------------------------------
+Building MSM-HBase
+ task-segment: [process-classes, org.codehaus.mojo:exec-maven-plugin:1.1.1:exec]
+------------------------------------------------------------------------
+[enforcer:enforce]
+[dependency:copy]
+[resources:resources]
+Using 'UTF-8' encoding to copy filtered resources.
+Copying 6 resources
+[compiler:compile]
+Nothing to compile - all classes are up to date
+[exec:exec]
+ INFO [main] (Environment.java:97) logEnv - Client environment:zookeeper.version=3.2.0--1, built on 05/15/2009 06:05 GMT
+ INFO [main] (Environment.java:97) logEnv - Client environment:host.name=devel
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.version=1.6.0_18
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.vendor=Sun Microsystems Inc.
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.home=/usr/java/jdk1.6.0_18/jre
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.class.path=/home/langlais/devel/mapstoragemanager/msm-hbase/target/classes:/home/langlais/.m2/repository/org/nuiton/msm/0.1-SNAPSHOT/msm-0.1-SNAPSHOT.jar:/home/langlais/.m2/repository/org/nuiton/nuiton-utils/1.1.0/nuiton-utils-1.1.0.jar:/home/langlais/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/langlais/.m2/repository/commons-primitives/commons-primitives/1.0/commons-primitives-1.0.jar:/home/langlais/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/langlais/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar:/home/langlais/.m2/repository/org/nuiton/i18n/nuiton-i18n-api/1.0.0/nuiton-i18n-api-1.0.0.jar:/home/langlais/.m2/repository/org/nuiton/jaxx/jaxx-runtime/2.0.0-beta-6-SNAPSHOT/jaxx-runtime-2.0.0-beta-6-SNAPSHOT.jar:/home/langlais/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/home/langlais/.m2/repository/org/swinglabs/jxlayer/3.0.3/jxlayer-3.0.3.jar:/home/langlais/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar:/home/langlais/.m2/repository/com/opensymphony/xwork/2.1.3/xwork-2.1.3.jar:/home/langlais/.m2/repository/opensymphony/ognl/2.6.11/ognl-2.6.11.jar:/home/langlais/.m2/repository/org/swinglabs/swingx/1.6/swingx-1.6.jar:/home/langlais/.m2/repository/com/jhlabs/filters/2.0.235/filters-2.0.235.jar:/home/langlais/.m2/repository/org/swinglabs/swing-worker/1.1/swing-worker-1.1.jar:/home/langlais/.m2/repository/org/nuiton/jaxx/jaxx-widgets/2.0.0-beta-6-SNAPSHOT/jaxx-widgets-2.0.0-beta-6-SNAPSHOT.jar:/home/langlais/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar:/home/langlais/.m2/repository/log4j/log4j/1.2.4/log4j-1.2.4.jar:/home/langlais/.m2/repository/org/apache/hadoop/zookeeper/zookeeper/r785019-hbase-1329/zookeeper-r785019-hbase-1329.jar:/home/langlais/.m2/repository/org/hadoop/hadoop/0.20.0-plus4681-core/hadoop-0.20.0-plus4681-core.jar:/home/langlais/.m2/repository/org/hadoop/hbase/0.20.0/hbase-0.20.0.jar:/home/langlais/.m2/repository/org/mortbay/jetty/jetty/6.1.8/jetty-6.1.8.jar:/home/langlais/.m2/repository/org/mortbay/jetty/jetty-util/6.1.8/jetty-util-6.1.8.jar:/home/langlais/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.8/servlet-api-2.5-6.1.8.jar
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.library.path=/usr/java/jdk1.6.0_18/jre/lib/amd64/server:/usr/java/jdk1.6.0_18/jre/lib/amd64:/usr/java/jdk1.6.0_18/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.io.tmpdir=/tmp
+ INFO [main] (Environment.java:97) logEnv - Client environment:java.compiler=<NA>
+ INFO [main] (Environment.java:97) logEnv - Client environment:os.name=Linux
+ INFO [main] (Environment.java:97) logEnv - Client environment:os.arch=amd64
+ INFO [main] (Environment.java:97) logEnv - Client environment:os.version=2.6.31-19-generic
+ INFO [main] (Environment.java:97) logEnv - Client environment:user.name=langlais
+ INFO [main] (Environment.java:97) logEnv - Client environment:user.home=/home/langlais
+ INFO [main] (Environment.java:97) logEnv - Client environment:user.dir=/home/langlais/devel/mapstoragemanager/msm-hbase
+ INFO [main] (ZooKeeper.java:342) <init> - Initiating client connection, host=localhost:2181 sessionTimeout=60000 watcher=org.apache.hadoop.hbase.client.HConnectionManager$ClientZKWatcher@2aca0115
+ INFO [main] (ClientCnxn.java:91) <clinit> - zookeeper.disableAutoWatchReset is false
+ INFO [main-SendThread] (ClientCnxn.java:821) startConnect - Attempting connection to server localhost/127.0.0.1:2181
+ INFO [main-SendThread] (ClientCnxn.java:737) primeConnection - Priming connection to java.nio.channels.SocketChannel[connected local=/127.0.0.1:47211 remote=localhost/127.0.0.1:2181]
+ INFO [main-SendThread] (ClientCnxn.java:889) run - Server connection successful
+Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
+ at $Proxy0.getRegionInfo(Unknown Source)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRootRegion(HConnectionManager.java:931)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:573)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:549)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegionInMeta(HConnectionManager.java:623)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:582)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:549)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegionInMeta(HConnectionManager.java:623)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:586)
+ at org.apache.hadoop.hbase.client.HConnectionManager$TableServers.locateRegion(HConnectionManager.java:549)
+ at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:125)
+ at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:103)
+ at org.nuiton.mapstoragemanager.plugins.hbase.MyLittleHBaseClient.main(MyLittleHBaseClient.java:44)
+Caused by: org.apache.hadoop.ipc.RemoteException: java.io.IOException: java.io.IOException: Could not find requested method, the usual cause is a version mismatch between client and server.
+ at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:648)
+ at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:915)
+
+ at org.apache.hadoop.hbase.ipc.HBaseClient.call(HBaseClient.java:723)
+ at org.apache.hadoop.hbase.ipc.HBaseRPC$Invoker.invoke(HBaseRPC.java:328)
+ ... 13 more
+------------------------------------------------------------------------
+[ERROR]BUILD ERROR
+------------------------------------------------------------------------
+Result of /bin/sh -c cd /home/langlais/devel/mapstoragemanager/msm-hbase && /usr/java/jdk1.6.0_18/bin/java -classpath /home/langlais/devel/mapstoragemanager/msm-hbase/target/classes:/home/langlais/.m2/repository/org/nuiton/msm/0.1-SNAPSHOT/msm-0.1-SNAPSHOT.jar:/home/langlais/.m2/repository/org/nuiton/nuiton-utils/1.1.0/nuiton-utils-1.1.0.jar:/home/langlais/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/home/langlais/.m2/repository/commons-primitives/commons-primitives/1.0/commons-primitives-1.0.jar:/home/langlais/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/langlais/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar:/home/langlais/.m2/repository/org/nuiton/i18n/nuiton-i18n-api/1.0.0/nuiton-i18n-api-1.0.0.jar:/home/langlais/.m2/repository/org/nuiton/jaxx/jaxx-runtime/2.0.0-beta-6-SNAPSHOT/jaxx-runtime-2.0.0-beta-6-SNAPSHOT.jar:/home/langlais/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/home/langlais/.m2/repository/org/swinglabs/jxlayer/3.0.3/jxlayer-3.0.3.jar:/home/langlais/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar:/home/langlais/.m2/repository/com/opensymphony/xwork/2.1.3/xwork-2.1.3.jar:/home/langlais/.m2/repository/opensymphony/ognl/2.6.11/ognl-2.6.11.jar:/home/langlais/.m2/repository/org/swinglabs/swingx/1.6/swingx-1.6.jar:/home/langlais/.m2/repository/com/jhlabs/filters/2.0.235/filters-2.0.235.jar:/home/langlais/.m2/repository/org/swinglabs/swing-worker/1.1/swing-worker-1.1.jar:/home/langlais/.m2/repository/org/nuiton/jaxx/jaxx-widgets/2.0.0-beta-6-SNAPSHOT/jaxx-widgets-2.0.0-beta-6-SNAPSHOT.jar:/home/langlais/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar:/home/langlais/.m2/repository/log4j/log4j/1.2.4/log4j-1.2.4.jar:/home/langlais/.m2/repository/org/apache/hadoop/zookeeper/zookeeper/r785019-hbase-1329/zookeeper-r785019-hbase-1329.jar:/home/langlais/.m2/repository/org/hadoop/hadoop/0.20.0-plus4681-core/hadoop-0.20.0-plus4681-core.jar:/home/langlais/.m2/repository/org/hadoop/hbase/0.20.0/hbase-0.20.0.jar:/home/langlais/.m2/repository/org/mortbay/jetty/jetty/6.1.8/jetty-6.1.8.jar:/home/langlais/.m2/repository/org/mortbay/jetty/jetty-util/6.1.8/jetty-util-6.1.8.jar:/home/langlais/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.8/servlet-api-2.5-6.1.8.jar org.nuiton.mapstoragemanager.plugins.hbase.MyLittleHBaseClient execution is: '1'.
+------------------------------------------------------------------------
+For more information, run Maven with the -e switch
+------------------------------------------------------------------------
+Total time: 9 seconds
+Finished at: Thu Feb 25 15:19:58 CET 2010
+Final Memory: 35M/84M
+------------------------------------------------------------------------
1
0
r126 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins
by dlanglais@users.nuiton.org Feb. 25, 2010
by dlanglais@users.nuiton.org Feb. 25, 2010
Feb. 25, 2010
Author: dlanglais
Date: 2010-02-25 15:12:17 +0100 (Thu, 25 Feb 2010)
New Revision: 126
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
Log:
modification mineures, j'ai un doute sur le fonctionnement de mapData, mais bon il s'agit d'une classe de test je suppose
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-24 15:34:36 UTC (rev 125)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-02-25 14:12:17 UTC (rev 126)
@@ -53,9 +53,10 @@
@Override
public void deleteColumn(String table, String column) {
if(mapTable.containsKey(table)){
- ArrayList<String> list = mapTable.get(table);
+ /*ArrayList<String> list = mapTable.get(table);
list.remove(column);
- mapTable.put(table,list);
+ mapTable.put(table,list);*/
+ mapTable.get(table).remove(column);
}
}
@@ -69,10 +70,11 @@
public void put(String table, String column, String key, String content) {
if(mapTable.containsKey(table)){
if(mapColumn.containsKey(column)){
- ArrayList<String> list;
+ /*ArrayList<String> list;
list = mapColumn.get(column);
list.add(key);
- mapColumn.put(column,list);
+ mapColumn.put(column,list);*/
+ mapColumn.get(column).add(key);
mapData.put(key, content);
}
}
@@ -80,20 +82,23 @@
@Override
public String get(String table, String column, String key) {
- if(mapTable.containsKey(table)){
- if(mapColumn.containsKey(column)){
- return mapData.get(key);
- }else{
- return "Erreur";
+ String ret = "";
+ if (mapTable.containsKey(table)) {
+ if (mapColumn.containsKey(column)) {
+ ret = mapData.get(key);
+ } else {
+ ret = "Column doesn't exist";
}
- }else{
- return "Erreur";
+ } else {
+ ret = "Table doesn't exist";
}
+ return ret;
}
@Override
public String get(String table, String column, String key, int version) {
- throw new UnsupportedOperationException("Not supported yet.");
+ return get(table, column, key);
+ // TODO
}
@Override
@@ -122,6 +127,4 @@
Set<String> keys = new HashSet(mapColumn.get(column));
return keys;
}
-
-
}
1
0