Mapstoragemanager-commits
Threads by month
- ----- 2026 -----
- 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
March 2010
- 6 participants
- 152 discussions
r202 - in trunk/msm-hbase/src: main/java/org/nuiton/mapstoragemanager/plugins/hbase test/java/org/nuiton/mapstoragemanager/plugins/hbase
by gcrieloue@users.nuiton.org 09 Mar '10
by gcrieloue@users.nuiton.org 09 Mar '10
09 Mar '10
Author: gcrieloue
Date: 2010-03-09 17:07:14 +0100 (Tue, 09 Mar 2010)
New Revision: 202
Log:
Ajout d'une classe de tests pour hbase
Added:
trunk/msm-hbase/src/test/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseTest.java
Modified:
trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java
Modified: trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java
===================================================================
--- trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java 2010-03-09 11:37:24 UTC (rev 201)
+++ trunk/msm-hbase/src/main/java/org/nuiton/mapstoragemanager/plugins/hbase/HBase.java 2010-03-09 16:07:14 UTC (rev 202)
@@ -6,6 +6,8 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.MasterNotRunningException;
@@ -14,6 +16,7 @@
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableExistsException;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
@@ -22,9 +25,9 @@
/**
* A plugin for MSM using HBase API.
- * @author Dorian Langlais
+ * @author Dorian Langlais, Crieloue Gilles
*/
-public class HBase implements BigTable {
+public class HBase /*implements BigTable*/ {
/**
* Logger.
@@ -68,7 +71,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public boolean connect(Properties properties) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -76,21 +79,26 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void createTable(String table) {
HTableDescriptor hTableDescriptor = new HTableDescriptor(table);
try {
hBaseAdmin.createTable(hTableDescriptor);
+
LOG.trace("table " + table + " created.");
+
+ } catch (TableExistsException e) {
+ LOG.trace("table " + table + " already created.");
} catch (IOException ex) {
LOG.error(ex, ex);
- }
+ }
+
}
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void deleteTable(String table) {
try {
// to delete a table, we have to disable it.
@@ -105,7 +113,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public Set<String> getTablesNames() {
Set<String> tablesNames = new HashSet<String>();
try {
@@ -115,7 +123,7 @@
for (int i = 0 ; i < hTablesDescriptor.length ; i++) {
tablesNames.add(hTablesDescriptor[i].getNameAsString());
}
-
+
} catch (IOException ex) {
LOG.error(ex, ex);
}
@@ -125,10 +133,12 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void createColumn(String table, String column) {
HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(column);
+
try {
+ hBaseAdmin.disableTable(table);
hBaseAdmin.addColumn(table, hColumnDescriptor);
LOG.trace("colum " + column + " created in table " + table + ".");
} catch (IOException ex) {
@@ -139,7 +149,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void deleteColumn(String table, String column) {
try {
hBaseAdmin.deleteColumn(table, column);
@@ -152,41 +162,41 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public Set<String> getColumnsNames(String table) {
Set<String> columnsNames = new HashSet<String>();
- try {
- if (hBaseAdmin.tableExists(table)) {
- HTableDescriptor hTableDescriptor;
- hTableDescriptor =
- hBaseAdmin.getTableDescriptor(table.getBytes());
-
- HColumnDescriptor[] hColumnsDescriptor;
- hColumnsDescriptor = hTableDescriptor.getColumnFamilies();
-
- for (int i = 0 ; i < hColumnsDescriptor.length ; i++) {
- columnsNames.add(hColumnsDescriptor[i].getNameAsString());
- }
-
- } else {
- try {
- throw new NoSuchTableException(table);
- } catch (NoSuchTableException ex) {
- LOG.error(ex, ex);
- }
- }
- } catch (MasterNotRunningException ex) {
- LOG.error(ex, ex);
- } catch (IOException ex) {
- LOG.error(ex, ex);
- }
+// try {
+// if (hBaseAdmin.tableExists(table)) {
+// HTableDescriptor hTableDescriptor;
+// hTableDescriptor =
+// hBaseAdmin.getTableDescriptor(table.getBytes());
+//
+// HColumnDescriptor[] hColumnsDescriptor;
+// hColumnsDescriptor = hTableDescriptor.getColumnFamilies();
+//
+// for (int i = 0 ; i < hColumnsDescriptor.length ; i++) {
+// columnsNames.add(hColumnsDescriptor[i].getNameAsString());
+// }
+//
+// } else {
+// try {
+// throw new NoSuchTableException(table);
+// } catch (NoSuchTableException ex) {
+// LOG.error(ex, ex);
+// }
+// }
+// } catch (MasterNotRunningException ex) {
+// LOG.error(ex, ex);
+// } catch (IOException ex) {
+// LOG.error(ex, ex);
+// }
return columnsNames;
}
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void put(String table, String column, String key, String content) {
try {
Put put = new Put(key.getBytes());
@@ -207,7 +217,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public String get(String table, String column, String key) {
String ret = "";
try {
@@ -233,7 +243,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public String get(String table, String column, String key, int version) {
String ret = "";
try {
@@ -261,7 +271,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public Map<String, String> getRow(String table, String key) {
Map<String, String> ret = new HashMap<String, String>();
try {
@@ -275,7 +285,7 @@
this.selectTable(table);
result = this.selectedTable.get(get);
}
-
+
String columnContent = result.getCellValue().toString();
ret.put(column, columnContent);
@@ -292,11 +302,11 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public Set<String> getKeys(String table) {
Set<String> ret = new HashSet<String>();
try {
-
+
synchronized (selectedTable) {
this.selectTable(table);
Set<byte[]> familiesKeys;
@@ -306,7 +316,7 @@
ret.add(key.toString());
}
}
-
+
} catch (IOException ex) {
LOG.error(ex, ex);
}
@@ -316,7 +326,7 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public void selectTable(String table) {
try {
selectedTable = new HTable(config, table);
@@ -328,8 +338,9 @@
/**
* {@inheritDoc}
*/
- @Override
+// @Override
public String getPluginName() {
return this.getClass().getSimpleName();
}
+
}
Added: trunk/msm-hbase/src/test/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseTest.java
===================================================================
--- trunk/msm-hbase/src/test/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseTest.java (rev 0)
+++ trunk/msm-hbase/src/test/java/org/nuiton/mapstoragemanager/plugins/hbase/HBaseTest.java 2010-03-09 16:07:14 UTC (rev 202)
@@ -0,0 +1,65 @@
+package org.nuiton.mapstoragemanager.plugins.hbase;
+
+import java.net.MalformedURLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.MasterNotRunningException;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.mapstoragemanager.plugins.hbase.HBase;
+
+/**
+ * An HBase test class.
+ * @author Crieloue Gilles
+ */
+public class HBaseTest {
+
+ private static final Log log = LogFactory.getLog(HBaseTest.class);
+
+ public HBaseTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test
+ * @throws MalformedURLException
+ */
+ @Test
+ public void testHBase() throws MalformedURLException {
+ String tableName = "myTable";
+ String columnName = "myColumn";
+ String contentValue = "val";
+ String keyValue="key";
+ try {
+ HBase hb = new HBase();
+ hb.createTable(tableName);
+ hb.createColumn(tableName, columnName);
+ hb.put(tableName, columnName, keyValue, contentValue);
+ log.trace(hb.get(tableName, columnName, keyValue));
+ } catch (MasterNotRunningException ex) {
+ Logger.getLogger(HBase.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+
+}
1
0
r201 - in trunk/msm-fromtoXPP3: . src/main/java/org/nuiton/mapstoragemanager/plugins/exporter src/test/java/org/nuiton/mapstoragemanager/plugins/exporter
by dlanglais@users.nuiton.org 09 Mar '10
by dlanglais@users.nuiton.org 09 Mar '10
09 Mar '10
Author: dlanglais
Date: 2010-03-09 12:37:24 +0100 (Tue, 09 Mar 2010)
New Revision: 201
Log:
Export ?\195?\160 l'aide de XPP3 fait et test?\195?\169
Added:
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java
Modified:
trunk/msm-fromtoXPP3/
trunk/msm-fromtoXPP3/pom.xml
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java
Property changes on: trunk/msm-fromtoXPP3
___________________________________________________________________
Added: svn:ignore
+ target
Modified: trunk/msm-fromtoXPP3/pom.xml
===================================================================
--- trunk/msm-fromtoXPP3/pom.xml 2010-03-09 10:53:28 UTC (rev 200)
+++ trunk/msm-fromtoXPP3/pom.xml 2010-03-09 11:37:24 UTC (rev 201)
@@ -83,7 +83,8 @@
<name>MSM-FromToXPP3</name>
- <description>Plugin for MapStorageManager to work with actuals HBase</description>
+ <description>Plugin to import/export database content from/to xml files
+ using XPP3.</description>
<inceptionYear>2010</inceptionYear>
<developers>
Modified: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java 2010-03-09 10:53:28 UTC (rev 200)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java 2010-03-09 11:37:24 UTC (rev 201)
@@ -1,15 +1,30 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
package org.nuiton.mapstoragemanager.plugins.exporter;
-import org.nuiton.mapstoragemanager.plugins.importer.*;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jdom.Document;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.BigTable;
-import org.nuiton.mapstoragemanager.plugins.Exporter;
+
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+import org.xmlpull.v1.XmlSerializer;
+
+
/**
- * A XML Parser - using pullparsing - to import database from xml files.
+ * A Class to export in xml files the content of Hbase database.
* @author Dorian Langlais
*/
public class ToXMLXPP3 implements Exporter {
@@ -18,46 +33,187 @@
* Logger.
*/
private static final Log LOG = LogFactory.getLog(ToXMLXPP3.class);
-
/**
- * Parsing State.
+ * the jdom document.
*/
- private ParsingState state;
+ private static Document document;
/**
- * Current Table, needed when create the database to know in which table
- * we are to add a new column.
- */
- private String currentTable;
- /**
* the fileFilter.
*/
private static FileFilter fileFilter;
/**
+ * NameSpace.
+ */
+ private static final String NAMESPACE = "";
+
+ /**
* Constructor.
*/
{
fileFilter = new FileNameExtensionFilter("Fichiers XML", "xml");
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final void exportTo(final BigTable bigTable, final File file) {
+
+ XmlSerializer serializer = null;
+ /**
+ * Initialisation of the serializer.
+ */
+ try {
+ XmlPullParserFactory factory =
+ XmlPullParserFactory.newInstance(
+ System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
+ serializer = factory.newSerializer();
+ } catch (XmlPullParserException ex) {
+ LOG.fatal(ex, ex);
+ }
+
+ try {
+
+ serializer.setOutput(new FileWriter(file));
+
+ serializer.startTag(NAMESPACE, "database");
+
+ {
+ this.describe(bigTable, serializer);
+
+ this.insert(bigTable, serializer);
+ }
+
+ serializer.endTag(NAMESPACE, "database");
+
+ serializer.endDocument();
+
+ } catch (IOException ex) {
+ LOG.fatal(ex, ex);
+ } catch (IllegalArgumentException ex) {
+ LOG.fatal(ex, ex);
+ } catch (IllegalStateException ex) {
+ LOG.fatal(ex, ex);
+ }
+ }
+
/**
- * {@inheritDoc}
+ * Write the description of the database.
+ * @param bigTable the bigTable.
+ * @param serializer the xmlSerializer.
*/
- public void exportTo(BigTable bigTable, File file) {
- throw new UnsupportedOperationException("Not supported yet.");
+ private void describe(final BigTable bigTable, final XmlSerializer
+ serializer) throws IllegalArgumentException, IllegalStateException,
+ IOException {
+
+ serializer.startTag(NAMESPACE, "describe");
+
+ /** for each Table */
+ for (String tableName : bigTable.getTablesNames()) {
+
+ serializer.startTag(NAMESPACE, "table");
+ serializer.attribute(NAMESPACE, "tableName", tableName);
+
+ /** for each Column */
+ for (String columnName : bigTable.getColumnsNames(tableName)) {
+ serializer.startTag(NAMESPACE, "column")
+ .attribute(null, "columnName", columnName)
+ .endTag(NAMESPACE, "column");
+
+ }
+
+ serializer.endTag(NAMESPACE, "table");
+ }
+ serializer.endTag(NAMESPACE, "describe");
}
/**
- * {@inheritDoc}
+ * Write the elements of the database.
+ * @param bigTable the bigTable.
+ * @param serializer the xmlSerializer.
*/
- public FileFilter getFileFilter() {
- return fileFilter;
+ private void insert(final BigTable bigTable, final XmlSerializer
+ serializer) throws IllegalArgumentException, IllegalStateException,
+ IOException {
+
+ String value;
+
+ serializer.startTag(NAMESPACE, "insert");
+
+ /** for each Table */
+ for (String tableName : bigTable.getTablesNames()) {
+
+ /** for each Column */
+ for (String columnName : bigTable.getColumnsNames(tableName)) {
+
+ /** for each Key */
+ for (String key : bigTable.getKeys(tableName)) {
+ value = bigTable.get(tableName, columnName, key);
+
+ /** if not "void" */
+ if (value != null && !"".equals(value)) {
+
+ serializer.startTag(NAMESPACE, "element")
+ .attribute(NAMESPACE, "table", tableName)
+ .attribute(NAMESPACE, "column", columnName)
+ .attribute(NAMESPACE, "key", key)
+ .attribute(NAMESPACE, "value", value)
+ .endTag(NAMESPACE, "element");
+ }
+ }
+
+ }
+ }
+ serializer.endTag(NAMESPACE, "insert");
}
/**
+ * 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(final File file) {
+ long t1 = System.currentTimeMillis();
+ try {
+ XMLOutputter output = new XMLOutputter(Format.getPrettyFormat());
+ FileOutputStream fos = new FileOutputStream(file);
+// GZIPOutputStream gzos = new GZIPOutputStream(fos);
+// output.output(document, gzos);
+ output.output(document, fos);
+ fos.close();
+ long t2 = System.currentTimeMillis();
+ LOG.info("temps d'enregistrement : " + (t2 - t1) + " ms.");
+ } catch (IOException ex) {
+ LOG.error(ex, ex);
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public String getPluginName() {
+ @Override
+ public final String getPluginName() {
return this.getClass().getSimpleName();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final FileFilter getFileFilter() {
+ return fileFilter;
+ }
}
Added: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java
===================================================================
--- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3Test.java 2010-03-09 11:37:24 UTC (rev 201)
@@ -0,0 +1,227 @@
+/*
+ * 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 junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+import org.nuiton.mapstoragemanager.plugins.Importer;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMapV2;
+import org.nuiton.mapstoragemanager.plugins.getFile;
+import org.nuiton.mapstoragemanager.plugins.importer.FromXMLXPP3;
+
+/**
+ *
+ * @author E054030D
+ */
+public class ToXMLXPP3Test extends TestCase {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ToXMLXPP3Test.class);
+
+ /**
+ * BigTable actual.
+ */
+ BigTable actual;
+ /**
+ * BigTable expected.
+ */
+ BigTable expected;
+
+
+ /**
+ * Test to export a bigTable database with empty Tables.
+ */
+ public void testEmptyTables() {
+
+ Exporter exporter = new ToXMLXPP3();
+
+ expected = new BigHashMapV2();
+ actual = new BigHashMapV2();
+ {
+ expected.createTable("table1");
+ expected.createTable("table2");
+ }
+
+ File exportTest =
+ getFile.getTestFile("/src/test/resources/exportTest.xml");
+
+ exporter.exportTo(expected,exportTest);
+
+ Importer importer = new FromXMLXPP3();
+ importer.importFrom(actual, exportTest);
+
+ /**
+ * Same tables.
+ */
+ assertEquals(expected.getTablesNames(),
+ actual.getTablesNames());
+
+ exportTest.delete();
+ }
+
+ /**
+ * Test to export a bigTable database with empty columns.
+ */
+ public void testEmptyColumns() {
+
+ Exporter exporter = new ToXMLXPP3();
+
+ expected = new BigHashMapV2();
+ actual = new BigHashMapV2();
+ {
+ expected.createTable("table1");
+ expected.createTable("table2");
+
+ expected.createColumn("table1", "column1");
+ expected.createColumn("table1", "column2");
+ expected.createColumn("table2", "column3");
+ expected.createColumn("table2", "column4");
+ expected.createColumn("table2", "column5");
+ }
+
+ File exportTest =
+ getFile.getTestFile("/src/test/resources/exportTest.xml");
+
+ exporter.exportTo(expected,exportTest);
+
+ Importer importer = new FromXMLXPP3();
+ importer.importFrom(actual, exportTest);
+
+ /**
+ * Same tables.
+ */
+ assertEquals(expected.getTablesNames(),
+ actual.getTablesNames());
+ /**
+ * Same columns.
+ */
+ for(String tableName : expected.getTablesNames()) {
+ assertEquals(expected.getColumnsNames(tableName),
+ actual.getColumnsNames(tableName));
+ }
+
+ exportTest.delete();
+ }
+
+ /**
+ * Test to export a bigTable database with empty columns.
+ */
+ public void testWithElements() {
+
+ Exporter exporter = new ToXMLXPP3();
+
+ expected = new BigHashMapV2();
+ actual = new BigHashMapV2();
+ {
+ expected.createTable("table1");
+ expected.createTable("table2");
+
+ expected.createColumn("table1", "column1");
+ expected.createColumn("table1", "column2");
+ expected.createColumn("table2", "column3");
+ expected.createColumn("table2", "column4");
+ expected.createColumn("table2", "column5");
+
+ expected.put("table1", "column1", "1", "content1");
+ expected.put("table1", "column1", "2", "content2");
+ expected.put("table1", "column2", "3", "content3");
+ expected.put("table1", "column2", "4", "content4");
+ expected.put("table2", "column3", "5", "content5");
+ expected.put("table2", "column3", "6", "content6");
+ expected.put("table2", "column4", "7", "content7");
+ expected.put("table2", "column4", "8", "content8");
+ expected.put("table2", "column5", "9", "content9");
+ expected.put("table2", "column5", "10", "content10");
+ }
+
+ File exportTest =
+ getFile.getTestFile("/src/test/resources/exportTest.xml");
+
+ exporter.exportTo(expected,exportTest);
+
+ Importer importer = new FromXMLXPP3();
+ importer.importFrom(actual, exportTest);
+
+ /**
+ * Same tables.
+ */
+ assertEquals(expected.getTablesNames(),
+ actual.getTablesNames());
+ /**
+ * Same columns.
+ */
+ for(String tableName : expected.getTablesNames()) {
+ assertEquals(expected.getColumnsNames(tableName),
+ actual.getColumnsNames(tableName));
+ }
+ /**
+ * Same elements.
+ */
+ String contentExpected, contentActual;
+
+ for(String tableName : expected.getTablesNames()) {
+
+ LOG.info("table : " + tableName);
+ for(String columnName : expected.getColumnsNames(tableName)) {
+
+ LOG.info("column : " + columnName);
+ for(String key : expected.getKeys(tableName)) {
+
+ LOG.info("key : " + key);
+ contentExpected = expected.get(tableName, columnName, key);
+ contentActual = actual.get(tableName, columnName, key);
+
+ LOG.info("expected : " + contentExpected);
+ LOG.info("actual : " + contentActual);
+ if(contentActual!=null && !"".equals(contentActual)) {
+ assertEquals(contentExpected, contentActual);
+ }
+ }
+ }
+ }
+
+ exportTest.delete();
+ }
+
+ public static void main(String[] args) {
+
+ Exporter exporter = new ToXMLXPP3();
+
+ BigTable bigTable = new BigHashMapV2();
+ {
+ bigTable.createTable("table1");
+ bigTable.createTable("table2");
+ bigTable.createColumn("table1", "column1");
+ bigTable.createColumn("table1", "column2");
+ bigTable.createColumn("table2", "column3");
+ bigTable.createColumn("table2", "column4");
+ bigTable.createColumn("table2", "column5");
+
+ bigTable.put("table1", "column1", "1", "content1");
+ bigTable.put("table1", "column1", "2", "content2");
+ bigTable.put("table1", "column2", "3", "content3");
+ bigTable.put("table1", "column2", "4", "content4");
+
+ bigTable.put("table2", "column3", "5", "content5");
+ bigTable.put("table2", "column3", "6", "content6");
+ bigTable.put("table2", "column4", "7", "content7");
+ bigTable.put("table2", "column4", "8", "content8");
+ bigTable.put("table2", "column5", "9", "content9");
+ bigTable.put("table2", "column5", "10", "content10");
+ }
+
+ File exportTest =
+ getFile.getTestFile("/src/test/resources/exportTest.xml");
+ exporter.exportTo(bigTable,exportTest);
+ exportTest.delete();
+ }
+}
1
0
Author: afages
Date: 2010-03-09 11:53:28 +0100 (Tue, 09 Mar 2010)
New Revision: 200
Log:
Modif rapport
Modified:
trunk/src/site/doc/rapport/rapport.rst
Modified: trunk/src/site/doc/rapport/rapport.rst
===================================================================
--- trunk/src/site/doc/rapport/rapport.rst 2010-03-09 10:28:16 UTC (rev 199)
+++ trunk/src/site/doc/rapport/rapport.rst 2010-03-09 10:53:28 UTC (rev 200)
@@ -10,7 +10,10 @@
:Version: 1.0 of 9/03/10
:Dedication: To Code Lutin & Université de Nantes
+------------------------------------------------------
+
Spécification préliminaire
==========================
-
+Demandeur
+---------
1
0
Author: fgilet
Date: 2010-03-09 11:28:16 +0100 (Tue, 09 Mar 2010)
New Revision: 199
Log:
Plugin de monitoring fonctionnel.
Added:
trunk/msm-monitoring-plugins/
trunk/msm-monitoring-plugins/LICENSE.txt
trunk/msm-monitoring-plugins/README.txt
trunk/msm-monitoring-plugins/changelog.txt
trunk/msm-monitoring-plugins/pom.xml
trunk/msm-monitoring-plugins/src/
trunk/msm-monitoring-plugins/src/main/
trunk/msm-monitoring-plugins/src/main/java/
trunk/msm-monitoring-plugins/src/main/java/org/
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/package-info.java
trunk/msm-monitoring-plugins/src/main/resources/
trunk/msm-monitoring-plugins/src/main/resources/META-INF/
trunk/msm-monitoring-plugins/src/main/resources/META-INF/services/
trunk/msm-monitoring-plugins/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Monitoring
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Monitoring.java
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java
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/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
trunk/pom.xml
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-03-09 10:24:57 UTC (rev 198)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -17,6 +17,7 @@
import org.nuiton.mapstoragemanager.plugins.BigTable;
import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.Importer;
+import org.nuiton.mapstoragemanager.plugins.Monitoring;
import org.nuiton.mapstoragemanager.plugins.Plugin;
/**
@@ -83,6 +84,8 @@
ServiceLoader.load(Importer.class, this);
ServiceLoader<Exporter> exporterSetLoader =
ServiceLoader.load(Exporter.class, this);
+ ServiceLoader<Monitoring> monitoringSetLoader =
+ ServiceLoader.load(Monitoring.class, this);
/**
* Add plugin in the plugin's map.
@@ -96,6 +99,9 @@
for (Exporter exporter : exporterSetLoader) {
plugins.put(exporter.getPluginName(), exporter);
}
+ for (Monitoring monitor : monitoringSetLoader) {
+ plugins.put(monitor.getPluginName(), monitor);
+ }
}
/**
Added: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Monitoring.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Monitoring.java (rev 0)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/Monitoring.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -0,0 +1,12 @@
+package org.nuiton.mapstoragemanager.plugins;
+
+/**
+ * @author E045231P
+ */
+public interface Monitoring extends Plugin {
+
+ /**
+ * display.
+ */
+ public void display();
+}
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-03-09 10:24:57 UTC (rev 198)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/plugins/OurHashMap2.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -147,7 +147,9 @@
/**
* {@inheritDoc}
*/
+ @Override
public final String getPluginName() {
return this.getClass().getSimpleName();
}
+
}
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-03-09 10:24:57 UTC (rev 198)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/ApplicationEngine.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -22,6 +22,7 @@
import org.nuiton.mapstoragemanager.plugins.BigTable;
import org.nuiton.mapstoragemanager.plugins.Exporter;
import org.nuiton.mapstoragemanager.plugins.Importer;
+import org.nuiton.mapstoragemanager.plugins.Monitoring;
import org.nuiton.mapstoragemanager.plugins.OurHashMap2;
import org.nuiton.mapstoragemanager.plugins.Plugin;
import org.nuiton.mapstoragemanager.ui.MainUI;
@@ -142,6 +143,10 @@
ui.getExporter().addItem(exporterItem);
ui.getExporter().setSelectedItem(exporterItem);
}
+ for (Plugin exPlugin : pluginLoader.getAllPlugin(Monitoring.class)) {
+ Monitoring monitor = (Monitoring) exPlugin;
+ monitor.display();
+ }
}
}
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-09 10:24:57 UTC (rev 198)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-09 10:28:16 UTC (rev 199)
@@ -1,56 +1,54 @@
-Empty=Empty
-Export\ Database=
-Exporter\ \:=
-Import\ Database=
-Importer\ \:=
-Map\ Storage\ Manager=Map Storage Manager
-No\ help\ today,\ sorry\ \!=
-connectionError=The connection attempt to failed, please retry \!
-connectionValid=The connection is established
-jaxxdemo.message.goto.site=Visit site
-jaxxdemo.tree.component=
-login\ \:=Login
-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.export=
-mapstoragemanager.action.export.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.import=
-mapstoragemanager.action.import.tip=
-mapstoragemanager.action.language=Choose language
-mapstoragemanager.action.language.tip=
-mapstoragemanager.action.menuHelp=Help
-mapstoragemanager.action.menuHelp.tip=
-mapstoragemanager.action.plugin=Plugins
-mapstoragemanager.action.plugin.tip=
-mapstoragemanager.action.pluginload=Load
-mapstoragemanager.action.pluginload.tip=Load plugins
-mapstoragemanager.action.pluginshow=Show
-mapstoragemanager.action.pluginshow.tip=Show plugins
-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
-no.help=No help today, sorry \!
-ok=Validate
-password\ \:=Password
-table.keys=Keys
-table.values=Values
-welcome.MapStorageManager=Welcome to MapStorageManager
+Empty=Empty
+Export\ Database=
+Exporter\ \:=
+Import\ Database=
+Importer\ \:=
+Map\ Storage\ Manager=Map Storage Manager
+connectionError=The connection attempt to failed, please retry \!
+connectionValid=The connection is established
+jaxxdemo.message.goto.site=Visit site
+login\ \:=Login
+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.export=Export
+mapstoragemanager.action.export.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.import=Import
+mapstoragemanager.action.import.tip=
+mapstoragemanager.action.language=Choose language
+mapstoragemanager.action.language.tip=
+mapstoragemanager.action.menuHelp=Help
+mapstoragemanager.action.menuHelp.tip=
+mapstoragemanager.action.plugin=Plugins
+mapstoragemanager.action.plugin.tip=
+mapstoragemanager.action.pluginload=Load
+mapstoragemanager.action.pluginload.tip=Load plugins
+mapstoragemanager.action.pluginshow=Show
+mapstoragemanager.action.pluginshow.tip=Show plugins
+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
+no.help=No help today, sorry \!
+ok=Validate
+password\ \:=Password
+table.keys=Keys
+table.values=Values
+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-03-09 10:24:57 UTC (rev 198)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-03-09 10:28:16 UTC (rev 199)
@@ -1,56 +1,54 @@
-Empty=Vide
-Export\ Database=
-Exporter\ \:=
-Import\ Database=
-Importer\ \:=
-Map\ Storage\ Manager=Map Storage Manager
-No\ help\ today,\ sorry\ \!=
-connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
-connectionValid=La connexion est \u00E9tablie
-jaxxdemo.message.goto.site=Visitez le site
-jaxxdemo.tree.component=
-login\ \:=Identifiant
-mapstoragemanager.action.aboutUs=A propos
-mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
-mapstoragemanager.action.connect=Connexion
-mapstoragemanager.action.connect.tip=Etablir 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.export=
-mapstoragemanager.action.export.tip=
-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.import=
-mapstoragemanager.action.import.tip=
-mapstoragemanager.action.language=Choisir la langue
-mapstoragemanager.action.language.tip=
-mapstoragemanager.action.menuHelp=Aide
-mapstoragemanager.action.menuHelp.tip=Aide contextuelle
-mapstoragemanager.action.plugin=Plugins
-mapstoragemanager.action.plugin.tip=
-mapstoragemanager.action.pluginload=R\u00E9cup\u00E9rer
-mapstoragemanager.action.pluginload.tip=R\u00E9cup\u00E9ration des plugins \u00E0 partir d'un dossier
-mapstoragemanager.action.pluginshow=Lister
-mapstoragemanager.action.pluginshow.tip=Liste des plugins disponible
-mapstoragemanager.action.preferences=Pr\u00E9f\u00E9rences
-mapstoragemanager.action.preferences.tip=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
-no.help=Pas d'aide pour l'instant, d\u00E9sol\u00E9 \!
-ok=Valider
-password\ \:=Mot de passe
-table.keys=Cl\u00E9s
-table.values=Valeurs
-welcome.MapStorageManager=Bienvenue dans MapStorageManager
+Empty=Vide
+Export\ Database=
+Exporter\ \:=
+Import\ Database=
+Importer\ \:=
+Map\ Storage\ Manager=Map Storage Manager
+connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
+connectionValid=La connexion est \u00E9tablie
+jaxxdemo.message.goto.site=Visitez le site
+login\ \:=Identifiant
+mapstoragemanager.action.aboutUs=A propos
+mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
+mapstoragemanager.action.connect=Connexion
+mapstoragemanager.action.connect.tip=Etablir 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.export=Exporter
+mapstoragemanager.action.export.tip=
+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.import=Importer
+mapstoragemanager.action.import.tip=
+mapstoragemanager.action.language=Choisir la langue
+mapstoragemanager.action.language.tip=
+mapstoragemanager.action.menuHelp=Aide
+mapstoragemanager.action.menuHelp.tip=Aide contextuelle
+mapstoragemanager.action.plugin=Plugins
+mapstoragemanager.action.plugin.tip=
+mapstoragemanager.action.pluginload=R\u00E9cup\u00E9rer
+mapstoragemanager.action.pluginload.tip=R\u00E9cup\u00E9ration des plugins \u00E0 partir d'un dossier
+mapstoragemanager.action.pluginshow=Lister
+mapstoragemanager.action.pluginshow.tip=Liste des plugins disponible
+mapstoragemanager.action.preferences=Pr\u00E9f\u00E9rences
+mapstoragemanager.action.preferences.tip=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
+no.help=Pas d'aide pour l'instant, d\u00E9sol\u00E9 \!
+ok=Valider
+password\ \:=Mot de passe
+table.keys=Cl\u00E9s
+table.values=Valeurs
+welcome.MapStorageManager=Bienvenue dans MapStorageManager
Added: trunk/msm-monitoring-plugins/LICENSE.txt
===================================================================
--- trunk/msm-monitoring-plugins/LICENSE.txt (rev 0)
+++ trunk/msm-monitoring-plugins/LICENSE.txt 2010-03-09 10:28:16 UTC (rev 199)
@@ -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-monitoring-plugins/changelog.txt
===================================================================
--- trunk/msm-monitoring-plugins/changelog.txt (rev 0)
+++ trunk/msm-monitoring-plugins/changelog.txt 2010-03-09 10:28:16 UTC (rev 199)
@@ -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-monitoring-plugins/pom.xml
===================================================================
--- trunk/msm-monitoring-plugins/pom.xml (rev 0)
+++ trunk/msm-monitoring-plugins/pom.xml 2010-03-09 10:28:16 UTC (rev 199)
@@ -0,0 +1,224 @@
+<?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-monitoring-plugins</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>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>
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>MSM-Monitoring-Plugins</name>
+
+ <description>Plugin for MapStorageManager to test with an implementation of
+ the BigTable Specification using HashMap.</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>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
\ No newline at end of file
Added: trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java
===================================================================
--- trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java (rev 0)
+++ trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/ShowDiskSpace.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -0,0 +1,77 @@
+package org.nuiton.monitoring;
+
+import java.awt.GridLayout;
+import java.io.File;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import org.nuiton.mapstoragemanager.plugins.Monitoring;
+
+/**
+ *
+ * @author E045231P
+ */
+public class ShowDiskSpace extends JFrame implements Monitoring {
+
+ /**
+ * Number for division byte -> Mb -> Gb.
+ */
+ public static int DIV = 1024;
+
+ /**
+ * Constructor.
+ */
+ public ShowDiskSpace(){
+ }
+
+ /**
+ * Display.
+ */
+ @Override
+ public void display(){
+ this.setTitle("Plugin ShowDiskSpace");
+ this.setSize(300, 300);
+ this.setLocationRelativeTo(null);
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ JPanel content = new JPanel();
+ File f = new File(new File("").getAbsolutePath()).getParentFile();
+ if (f.exists()) {
+ long freeSpaceByte = f.getFreeSpace();
+ long totalSpaceByte = f.getTotalSpace();
+ long usableSpaceByte = f.getUsableSpace();
+ double freeSpaceMb = freeSpaceByte/(DIV*DIV);
+ double totalSpaceMb = totalSpaceByte/(DIV*DIV);
+ double usableSpaceMb = usableSpaceByte/(DIV*DIV);
+ double freeSpaceGb = freeSpaceMb/DIV;
+ double totalSpaceGb = totalSpaceMb/DIV;
+ double usableSpaceGb = usableSpaceMb/DIV;
+ content.setLayout(new GridLayout(7,1));
+ content.add(new JLabel("freeSpace : "+freeSpaceMb+" Mb ("+freeSpaceGb+" Gb)"));
+ content.add(new JLabel("totalSpace : "+totalSpaceMb+" Mb ("+totalSpaceGb+" Gb)"));
+ content.add(new JLabel("usableSpace : "+usableSpaceMb+" Mb ("+usableSpaceGb+" Gb)"));
+ content.add(new JLabel(""));
+ }
+ Runtime runtime = Runtime.getRuntime();
+ long freeMemoryByte = runtime.freeMemory();
+ long totalMemoryByte = runtime.totalMemory();
+ long maxMemoryByte = runtime.maxMemory();
+ double freeMemoryMb = freeMemoryByte/(DIV*DIV);
+ double totalMemoryMb = totalMemoryByte/(DIV*DIV);
+ double maxMemoryMb = maxMemoryByte/(DIV*DIV);
+ double freeMemoryGb = freeMemoryMb/DIV;
+ double totalMemoryGb = totalMemoryMb/DIV;
+ double maxMemoryGb = maxMemoryMb/DIV;
+ content.add(new JLabel("freeMemory : "+freeMemoryMb+" Mb ("+freeMemoryGb+" Gb)"));
+ content.add(new JLabel("totalMemory : "+totalMemoryMb+" Mb ("+totalMemoryGb+" Gb)"));
+ content.add(new JLabel("maxMemory : "+maxMemoryMb+" Mb ("+maxMemoryGb+" Gb)"));
+
+ this.setContentPane(content);
+ this.pack();
+ this.setVisible(true);
+ }
+
+ public String getPluginName() {
+ return this.getClass().getSimpleName();
+ }
+}
Added: trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/package-info.java
===================================================================
--- trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/package-info.java (rev 0)
+++ trunk/msm-monitoring-plugins/src/main/java/org/nuiton/monitoring/package-info.java 2010-03-09 10:28:16 UTC (rev 199)
@@ -0,0 +1,5 @@
+/**
+ * Package org.pluginDiskSpace.
+ * contains an ui plugin for mapstoragemanager.
+ */
+package org.pluginDiskSpace;
\ No newline at end of file
Added: trunk/msm-monitoring-plugins/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Monitoring
===================================================================
--- trunk/msm-monitoring-plugins/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Monitoring (rev 0)
+++ trunk/msm-monitoring-plugins/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Monitoring 2010-03-09 10:28:16 UTC (rev 199)
@@ -0,0 +1 @@
+org.nuiton.monitoring.ShowDiskSpace
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-09 10:24:57 UTC (rev 198)
+++ trunk/pom.xml 2010-03-09 10:28:16 UTC (rev 199)
@@ -23,6 +23,7 @@
<module>msm-hbase</module>
<module>msm-fromtoXML</module>
<module>msm-fromtoXPP3</module>
+ <module>msm-monitoring-plugins</module>
</modules>
<!-- ************************************************************* -->
1
0
Author: afages
Date: 2010-03-09 11:24:57 +0100 (Tue, 09 Mar 2010)
New Revision: 198
Log:
Modification planning + ajout rapport
Added:
trunk/src/site/doc/rapport/
trunk/src/site/doc/rapport/rapport.rst
trunk/src/site/doc/rapport/rst2pdf-net.py
trunk/src/site/doc/soutenance/
Modified:
trunk/src/site/reports/CompteRendu_02-03-2010.rst
trunk/src/site/reports/planningMSM.xls
Added: trunk/src/site/doc/rapport/rapport.rst
===================================================================
--- trunk/src/site/doc/rapport/rapport.rst (rev 0)
+++ trunk/src/site/doc/rapport/rapport.rst 2010-03-09 10:24:57 UTC (rev 198)
@@ -0,0 +1,16 @@
+Rapport du projet de fin d'étude : Map Storage Manager
+======================================================
+
+:Authors:
+ Gilles CRIELOUE.,
+ Dorian LANGLAIS.,
+ Florent GILET.,
+ Amaury FAGES.,
+
+:Version: 1.0 of 9/03/10
+:Dedication: To Code Lutin & Université de Nantes
+
+Spécification préliminaire
+==========================
+
+
Added: trunk/src/site/doc/rapport/rst2pdf-net.py
===================================================================
--- trunk/src/site/doc/rapport/rst2pdf-net.py (rev 0)
+++ trunk/src/site/doc/rapport/rst2pdf-net.py 2010-03-09 10:24:57 UTC (rev 198)
@@ -0,0 +1,147 @@
+#!/usr/bin/env python
+import os
+import sys
+import time
+import urllib2
+from urllib2 import HTTPError
+from urllib import urlencode
+from optparse import OptionParser
+
+CLIENT_VERSION = '1.0'
+API_VERSION = '1'
+
+API_BASE_URL = '%s://%s'
+API_POST = '%s/post'
+API_DOWNLOAD = '%s/download'
+API_SCRIPT_VERSION = '%s/script_version'
+
+DEFAULT_PROTCOL = 'http'
+DEFAULT_DOMAIN = 'www.rst2pdf.net'
+DEFAULT_ENCODING = 'utf-8'
+DEFAULT_RETRY_NUM = 5
+DEFAULT_SECURE_PROTCOL = 'https'
+DEFAULT_SECURE_DOMAIN = 'rst2pdf-net.appspot.com'
+
+def get_opener():
+ opener = urllib2.build_opener()
+ opener.addheaders = [('User-agent', 'rst2pdf-net/%s' % CLIENT_VERSION)]
+ return opener
+
+def url_get(url, retry=DEFAULT_RETRY_NUM, output_status=True, output=sys.stdout):
+ opener = get_opener()
+ for x in range(retry):
+ if output_status:
+ output.write('.')
+ try:
+ time.sleep(x * 2)
+ response = opener.open(url)
+ return response.read()
+ except HTTPError:
+ pass
+ return None
+
+def rst_net_post(body, domain=DEFAULT_DOMAIN, protocol=DEFAULT_PROTCOL, password=None):
+ url_base = API_BASE_URL % (protocol, domain)
+ url_post = API_POST % url_base
+ opener = get_opener()
+ params = {'body': body, 'format': 'text', 'version': API_VERSION}
+ if password:
+ params['password'] = password
+ response = opener.open(url_post, urlencode(params))
+ return response.read()
+
+def parse_text_response(response):
+ response_dict = {}
+ for line in response.splitlines():
+ if line and '=' in line:
+ key, value = line.split('=', 1)
+ response_dict[key] = value
+ return response_dict
+
+def main():
+ usage = "Usage: %prog [options] [filename]"
+ parser = OptionParser(usage=usage)
+ parser.add_option('-d', '--domain',
+ dest='domain',
+ help='use other domain, default domain is "%s", if secure mode is "%s"' \
+ % (DEFAULT_DOMAIN, DEFAULT_SECURE_DOMAIN),
+ default=DEFAULT_DOMAIN)
+ parser.add_option('-c', '--protocol',
+ dest='protocol',
+ help='use other protocol, default protocol is "%s", if secure mode is "%s"' \
+ % (DEFAULT_PROTCOL, DEFAULT_SECURE_PROTCOL))
+ parser.add_option('-e', '--encoding',
+ dest='encoding',
+ help='use other input encoding, default encoding is "%s"' % DEFAULT_ENCODING)
+ parser.add_option('-o', '--output',
+ dest='output',
+ help='output file path')
+ parser.add_option('-s', '--secure',
+ action='store_true',
+ dest='secure',
+ help='use secure mode')
+ parser.add_option('-p', '--password',
+ dest='password',
+ help='use password(force secure mode)')
+ options, args = parser.parse_args()
+
+ if not args:
+ stream = sys.stdin
+ input_file = ''
+ else:
+ stream = open(args[0], 'rb')
+ input_file = args[0]
+ source = stream.read()
+ if options.encoding:
+ source = source.decode(options.encoding).encode(DEFAULT_ENCODING)
+ secure = options.secure
+ if options.password:
+ secure = True
+ domain = options.domain
+ protocol = options.protocol
+ if secure:
+ if domain == DEFAULT_DOMAIN:
+ domain = DEFAULT_SECURE_DOMAIN
+ if not protocol:
+ protocol = DEFAULT_SECURE_PROTCOL
+ protocol = protocol or DEFAULT_PROTCOL
+
+ sys.stdout.write('Sending rst...\n')
+
+ response = parse_text_response(rst_net_post(source, domain, protocol, options.password))
+
+ if not 'hash' in response:
+ sys.stderr.write("Error: Response don't have hash key.\n")
+ return
+
+ sys.stdout.write('Document hash: %s\n' % response['hash'])
+
+ if options.password:
+ sys.stdout.write('Pdf was created, download url is "%s".\n' % response['url'])
+ else:
+ url_download = API_DOWNLOAD % response['url'][:-1]
+
+ sys.stdout.write('Downloading pdf from "%s"\n' % url_download)
+
+ pdf_body = url_get(url_download)
+ sys.stdout.write('\n')
+ if not pdf_body:
+ sys.stderr.write('Error: Download faled "%s".\n' % url_download)
+ return
+
+ if options.output:
+ output_file = options.output
+ elif input_file:
+ base, ext = os.path.splitext(input_file)
+ output_file = '%s.pdf' % base
+ else:
+ output_file = '%s.pdf' % response['hash']
+ sys.stdout.write('Writing pdf file "%s"...\n' % output_file)
+ f = open(output_file, 'wb')
+ f.write(pdf_body)
+ f.close()
+
+ sys.stdout.write('Completed.\n')
+
+if __name__ == '__main__':
+ main()
Modified: trunk/src/site/reports/CompteRendu_02-03-2010.rst
===================================================================
--- trunk/src/site/reports/CompteRendu_02-03-2010.rst 2010-03-08 20:36:48 UTC (rev 197)
+++ trunk/src/site/reports/CompteRendu_02-03-2010.rst 2010-03-09 10:24:57 UTC (rev 198)
@@ -39,8 +39,8 @@
RAF (Reste à faire)
-------------------
--H/J sur le planning. (Amaury)
--Estimation avec JTimer sur le temps passé sur les taches. (Amaury)
+-H/J sur le planning. (Amaury) DONE
+-Estimation avec JTimer sur le temps passé sur les taches. (Amaury) ~DONE
-Rendre plus générique le loader de plugin (BigTableLoader -> PluginLoader). (Gilles)
-Le plugin (exemple : import/export) doit pouvoir rajouter des entrées dans le menu. (Dorian)
-Adapter l'affichage de la table à la largeur de la fenêtre. (Florent)
Modified: trunk/src/site/reports/planningMSM.xls
===================================================================
(Binary files differ)
1
0
r197 - in trunk/msm/src/main: java/org/nuiton/mapstoragemanager/ui java/org/nuiton/mapstoragemanager/ui/gui resources/i18n
by fgilet@users.nuiton.org 08 Mar '10
by fgilet@users.nuiton.org 08 Mar '10
08 Mar '10
Author: fgilet
Date: 2010-03-08 21:36:48 +0100 (Mon, 08 Mar 2010)
New Revision: 197
Log:
Redimension du tableau contenant les donn?\195?\169es d'une table.
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java
trunk/msm/src/main/resources/i18n/msm-en_GB.properties
trunk/msm/src/main/resources/i18n/msm-fr_FR.properties
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-03-08 11:31:03 UTC (rev 196)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/MainUI.css 2010-03-08 20:36:48 UTC (rev 197)
@@ -53,12 +53,14 @@
text:"mapstoragemanager.action.import";
toolTipText:"mapstoragemanager.action.import.tip";
actionIcon:"databaseImport_16";
+ mnemonic:I;
}
#menuExport {
text:"mapstoragemanager.action.export";
toolTipText:"mapstoragemanager.action.export.tip";
actionIcon:"databaseExport_16";
+ mnemonic:T;
}
#menuExit {
@@ -78,16 +80,19 @@
#menuPlugin {
text:"mapstoragemanager.action.plugin";
toolTipText:"mapstoragemanager.action.plugin.tip";
+ mnemonic:P;
}
#menuPluginLoad {
text:"mapstoragemanager.action.pluginload";
toolTipText:"mapstoragemanager.action.pluginload.tip";
+ mnemonic:A;
}
#menuPluginShow {
text:"mapstoragemanager.action.pluginshow";
toolTipText:"mapstoragemanager.action.pluginshow.tip";
+ mnemonic:O;
}
#menuHelp {
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-03-08 11:31:03 UTC (rev 196)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MSMNavigationListener.java 2010-03-08 20:36:48 UTC (rev 197)
@@ -1,8 +1,12 @@
package org.nuiton.mapstoragemanager.ui.gui;
+import java.awt.Color;
+import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
+import javax.swing.border.Border;
+import javax.swing.border.LineBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
@@ -27,37 +31,32 @@
ui.getTableContent().removeAll();
ui.getTableName().removeAll();
+ JTable jTable = null;
/* 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);
-
+ jTable = new JTable(model);
} else {
//we create a standard model of table
TableModel model = new TableModel(node);
- JTable jTable = new JTable(model);
+ jTable = new JTable(model);
+ }
- JScrollPane scrollPane = new JScrollPane(jTable);
- jTable.setFillsViewportHeight(true);
+ JScrollPane scrollPane = new JScrollPane(jTable);
+ jTable.setFillsViewportHeight(true);
+ int height = (int)ui.getTableContent().getSize().getHeight();
+ int width = (int)ui.getTableContent().getSize().getWidth();
+ Dimension screen = new Dimension(width-100, height-100);
+ jTable.setPreferredScrollableViewportSize(screen);
- //we check attributes and values of the select table
+ //we check attributes and values of the select table
- //and display the result into the JPanel named 'tableContent'
- ui.getTableContent().add(scrollPane);
- }
+ //and display the result into the JPanel named 'tableContent'
+ ui.getTableContent().add(scrollPane);
ui.getTableName().add(new JLabel("<html><b><u>" + node.toString()
+ "</b></u></html>"));
Modified: trunk/msm/src/main/resources/i18n/msm-en_GB.properties
===================================================================
--- trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-08 11:31:03 UTC (rev 196)
+++ trunk/msm/src/main/resources/i18n/msm-en_GB.properties 2010-03-08 20:36:48 UTC (rev 197)
@@ -4,9 +4,11 @@
Import\ Database=
Importer\ \:=
Map\ Storage\ Manager=Map Storage Manager
+No\ help\ today,\ sorry\ \!=
connectionError=The connection attempt to failed, please retry \!
connectionValid=The connection is established
jaxxdemo.message.goto.site=Visit site
+jaxxdemo.tree.component=
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-03-08 11:31:03 UTC (rev 196)
+++ trunk/msm/src/main/resources/i18n/msm-fr_FR.properties 2010-03-08 20:36:48 UTC (rev 197)
@@ -4,9 +4,11 @@
Import\ Database=
Importer\ \:=
Map\ Storage\ Manager=Map Storage Manager
+No\ help\ today,\ sorry\ \!=
connectionError=La connexion \u00E0 \u00E9chou\u00E9e, r\u00E9essayez s'il vous pla\u00EEt \!
connectionValid=La connexion est \u00E9tablie
jaxxdemo.message.goto.site=Visitez le site
+jaxxdemo.tree.component=
login\ \:=Identifiant
mapstoragemanager.action.aboutUs=A propos
mapstoragemanager.action.aboutUs.tip=A propos de Code Lutin
1
0
r196 - trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer
by dlanglais@users.nuiton.org 08 Mar '10
by dlanglais@users.nuiton.org 08 Mar '10
08 Mar '10
Author: dlanglais
Date: 2010-03-08 12:31:03 +0100 (Mon, 08 Mar 2010)
New Revision: 196
Log:
Am?\195?\169lioration qualit?\195?\169 sur FromXMLXPP3.
Modified:
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java
Modified: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java 2010-03-08 06:16:04 UTC (rev 195)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java 2010-03-08 11:31:03 UTC (rev 196)
@@ -89,10 +89,10 @@
do {
if(eventType == XmlPullParser.START_DOCUMENT) {
- System.out.println("Start document");
+ LOG.info("Start document");
state = ParsingState.START;
} else if(eventType == XmlPullParser.END_DOCUMENT) {
- System.out.println("End document");
+ LOG.info("End document");
} else if(eventType == XmlPullParser.START_TAG) {
processStartElement(bigTable, xpp);
// } else if(eventType == XmlPullParser.END_TAG) {
@@ -110,6 +110,7 @@
* @param xpp XmlPullParser.
*/
public void processStartElement (BigTable bigTable, XmlPullParser xpp) {
+
final String elementName = xpp.getName();
final int nbAttribute = xpp.getAttributeCount();
@@ -117,40 +118,33 @@
for (int i = 0 ; i < nbAttribute ; i++ ) {
attributes.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
}
+
+ LOG.trace("Start element : <" + elementName + ">" +
+ "\tAttributes : " + attributes.toString());
- if(elementName.equals("describe")) {
- LOG.trace("Start Describe Database");
+
+ if("describe".equals(elementName)) { /** Element Describe */
state = ParsingState.START_DESCRIBE_DATABASE;
- } else if (elementName.equals("table")) {
- LOG.trace("Start Describe Table");
+ } else if ("table".equals(elementName)) { /** Element Table */
state = ParsingState.START_DESCRIBE_TABLE;
- } else if (elementName.equals("column")) {
- LOG.trace("Start Describe Column");
- state = ParsingState.START_DESCRIBE_COLUMN;
- } else if (elementName.equals("insert")) {
- LOG.trace("Start Insert");
- state = ParsingState.START_INSERT_DATA;
- } else if (elementName.equals("element")) {
- LOG.trace("Start Insert new Element");
- state = ParsingState.INSERT_DATA;
- }
-
- System.out.println("Start element : <" + elementName + ">");
- System.out.println("Attributes : " + attributes.toString());
-
- switch (state) {
- case START_DESCRIBE_TABLE :
+ {
final String tableName = attributes.get("tableName");
LOG.info("Create Table : " + tableName);
bigTable.createTable(tableName);
currentTable = tableName;
- break;
- case START_DESCRIBE_COLUMN :
+ }
+ } else if ("column".equals(elementName)) { /** Element Column */
+ state = ParsingState.START_DESCRIBE_COLUMN;
+ {
final String columnName = attributes.get("columnName");
- LOG.info("Create Column : " + columnName);
+ LOG.info("Create Column : " + currentTable + ":" + columnName);
bigTable.createColumn(currentTable, columnName);
- break;
- case INSERT_DATA :
+ }
+ } else if ("insert".equals(elementName)) { /** Element Insert */
+ state = ParsingState.START_INSERT_DATA;
+ } else if ("element".equals(elementName)) { /** Element Element */
+ state = ParsingState.INSERT_DATA;
+ {
// if(attributes.keySet().contains("version")) {
// bigTable.put(
// attributes.get("table"),
@@ -159,12 +153,18 @@
// attributes.get("version"),
// attributes.get("value"));
// } else {
+
+ LOG.info("Insert : " + attributes.get("table") + ":"
+ + attributes.get("column") + ":"
+ + attributes.get("key") + " -> "
+ + attributes.get("value"));
bigTable.put(
attributes.get("table"),
attributes.get("column"),
attributes.get("key"),
attributes.get("value"));
// }
+ }
}
}
1
0
Author: dlanglais
Date: 2010-03-08 07:16:04 +0100 (Mon, 08 Mar 2010)
New Revision: 195
Log:
Cr?\195?\169ation d'un plugin Import/Export xml utilisant XPP3.
Pour le moment seul l'import est impl?\195?\169ment?\195?\169.
Added:
trunk/msm-fromtoXPP3/
trunk/msm-fromtoXPP3/LICENSE.txt
trunk/msm-fromtoXPP3/README.txt
trunk/msm-fromtoXPP3/changelog.txt
trunk/msm-fromtoXPP3/pom.xml
trunk/msm-fromtoXPP3/src/
trunk/msm-fromtoXPP3/src/main/
trunk/msm-fromtoXPP3/src/main/java/
trunk/msm-fromtoXPP3/src/main/java/org/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/ParsingState.java
trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
trunk/msm-fromtoXPP3/src/main/resources/
trunk/msm-fromtoXPP3/src/main/resources/META-INF/
trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/
trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter
trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer
trunk/msm-fromtoXPP3/src/site/
trunk/msm-fromtoXPP3/src/site/doc/
trunk/msm-fromtoXPP3/src/site/doc/xsd/
trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.dtd
trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.xml
trunk/msm-fromtoXPP3/src/site/todo.rst
trunk/msm-fromtoXPP3/src/test/
trunk/msm-fromtoXPP3/src/test/java/
trunk/msm-fromtoXPP3/src/test/java/org/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/exporter/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/fromto/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/getFile.java
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Main.java
trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/tofrom/
trunk/msm-fromtoXPP3/src/test/resources/
trunk/msm-fromtoXPP3/src/test/resources/fiveColumns.xml
trunk/msm-fromtoXPP3/src/test/resources/fiveTables.xml
trunk/msm-fromtoXPP3/src/test/resources/importTest.xml
trunk/msm-fromtoXPP3/src/test/resources/sixCells.xml
Modified:
trunk/pom.xml
Added: trunk/msm-fromtoXPP3/LICENSE.txt
===================================================================
--- trunk/msm-fromtoXPP3/LICENSE.txt (rev 0)
+++ trunk/msm-fromtoXPP3/LICENSE.txt 2010-03-08 06:16:04 UTC (rev 195)
@@ -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-fromtoXPP3/changelog.txt
===================================================================
--- trunk/msm-fromtoXPP3/changelog.txt (rev 0)
+++ trunk/msm-fromtoXPP3/changelog.txt 2010-03-08 06:16:04 UTC (rev 195)
@@ -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-fromtoXPP3/pom.xml
===================================================================
--- trunk/msm-fromtoXPP3/pom.xml (rev 0)
+++ trunk/msm-fromtoXPP3/pom.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,278 @@
+<?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-fromtoxpp3</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>
+ <type>jar</type>
+ </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>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.4c</version>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ </dependency>
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>MSM-FromToXPP3</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>
+ <plugins>
+
+ <!--<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version></version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> this is used for inheritance merges
+ <phase>package</phase> append to the packaging phase.
+ <goals>
+ <goal>attached</goal> goals == mojos
+ </goals>
+ </execution>
+ </executions>
+ </plugin>-->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/ToXMLXPP3.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,63 @@
+package org.nuiton.mapstoragemanager.plugins.exporter;
+
+import org.nuiton.mapstoragemanager.plugins.importer.*;
+import java.io.File;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.Exporter;
+/**
+ * A XML Parser - using pullparsing - to import database from xml files.
+ * @author Dorian Langlais
+ */
+public class ToXMLXPP3 implements Exporter {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(ToXMLXPP3.class);
+
+ /**
+ * Parsing State.
+ */
+ private ParsingState state;
+ /**
+ * Current Table, needed when create the database to know in which table
+ * we are to add a new column.
+ */
+ private String currentTable;
+ /**
+ * the fileFilter.
+ */
+ private static FileFilter fileFilter;
+
+ /**
+ * Constructor.
+ */
+ {
+ fileFilter = new FileNameExtensionFilter("Fichiers XML", "xml");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void exportTo(BigTable bigTable, File file) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FileFilter getFileFilter() {
+ return fileFilter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPluginName() {
+ return this.getClass().getSimpleName();
+ }
+}
Added: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/exporter/package-info.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.exporter;
+/**
+ * @package exporter.
+ * Export bigtable database in xml files.
+ */
Added: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,184 @@
+package org.nuiton.mapstoragemanager.plugins.importer;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.swing.filechooser.FileFilter;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.Importer;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import org.xmlpull.v1.XmlPullParserFactory;
+
+/**
+ * A XML Parser - using pullparsing - to import database from xml files.
+ * @author Dorian Langlais
+ */
+public class FromXMLXPP3 implements Importer {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(FromXMLXPP3.class);
+
+ /**
+ * Parsing State.
+ */
+ private ParsingState state;
+ /**
+ * Current Table, needed when create the database to know in which table
+ * we are to add a new column.
+ */
+ private String currentTable;
+ /**
+ * the fileFilter.
+ */
+ private static FileFilter fileFilter;
+
+ /**
+ * Constructor.
+ */
+ {
+ fileFilter = new FileNameExtensionFilter("Fichiers XML", "xml");
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void importFrom(BigTable bigTable, File file) {
+
+ try {
+ XmlPullParserFactory factory = XmlPullParserFactory.newInstance(System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null);
+ //factory.setNamespaceAware(true);
+ factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
+ XmlPullParser xpp = factory.newPullParser();
+ FromXMLXPP3 app = new FromXMLXPP3();
+
+ /**
+ * Start Parsing.
+ */
+ xpp.setInput(new FileReader(file));
+ app.processDocument(bigTable, xpp);
+
+ } catch (FileNotFoundException ex) {
+ LOG.fatal(ex, ex);
+ } catch (IOException ex) {
+ LOG.fatal(ex, ex);
+ } catch (XmlPullParserException ex) {
+ LOG.fatal(ex, ex);
+ }
+ }
+
+ /**
+ * Process Document.
+ * @param bigTable the bigTable.
+ * @param xpp XmlPullParser.
+ * @throws XmlPullParserException
+ * @throws IOException
+ */
+ public void processDocument(BigTable bigTable, XmlPullParser xpp)
+ throws XmlPullParserException, IOException {
+ int eventType = xpp.getEventType();
+
+ do {
+ if(eventType == XmlPullParser.START_DOCUMENT) {
+ System.out.println("Start document");
+ state = ParsingState.START;
+ } else if(eventType == XmlPullParser.END_DOCUMENT) {
+ System.out.println("End document");
+ } else if(eventType == XmlPullParser.START_TAG) {
+ processStartElement(bigTable, xpp);
+// } else if(eventType == XmlPullParser.END_TAG) {
+// processEndElement(xpp);
+// } else if(eventType == XmlPullParser.TEXT) {
+// processText(xpp);
+ }
+ eventType = xpp.next();
+ } while (eventType != XmlPullParser.END_DOCUMENT);
+ }
+
+ /**
+ * Process an element when we start reading it.
+ * @param bigTable the bigTable.
+ * @param xpp XmlPullParser.
+ */
+ public void processStartElement (BigTable bigTable, XmlPullParser xpp) {
+ final String elementName = xpp.getName();
+ final int nbAttribute = xpp.getAttributeCount();
+
+ final Map<String, String> attributes = new HashMap<String, String>();
+ for (int i = 0 ; i < nbAttribute ; i++ ) {
+ attributes.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
+ }
+
+ if(elementName.equals("describe")) {
+ LOG.trace("Start Describe Database");
+ state = ParsingState.START_DESCRIBE_DATABASE;
+ } else if (elementName.equals("table")) {
+ LOG.trace("Start Describe Table");
+ state = ParsingState.START_DESCRIBE_TABLE;
+ } else if (elementName.equals("column")) {
+ LOG.trace("Start Describe Column");
+ state = ParsingState.START_DESCRIBE_COLUMN;
+ } else if (elementName.equals("insert")) {
+ LOG.trace("Start Insert");
+ state = ParsingState.START_INSERT_DATA;
+ } else if (elementName.equals("element")) {
+ LOG.trace("Start Insert new Element");
+ state = ParsingState.INSERT_DATA;
+ }
+
+ System.out.println("Start element : <" + elementName + ">");
+ System.out.println("Attributes : " + attributes.toString());
+
+ switch (state) {
+ case START_DESCRIBE_TABLE :
+ final String tableName = attributes.get("tableName");
+ LOG.info("Create Table : " + tableName);
+ bigTable.createTable(tableName);
+ currentTable = tableName;
+ break;
+ case START_DESCRIBE_COLUMN :
+ final String columnName = attributes.get("columnName");
+ LOG.info("Create Column : " + columnName);
+ bigTable.createColumn(currentTable, columnName);
+ break;
+ case INSERT_DATA :
+// if(attributes.keySet().contains("version")) {
+// bigTable.put(
+// attributes.get("table"),
+// attributes.get("column"),
+// attributes.get("key"),
+// attributes.get("version"),
+// attributes.get("value"));
+// } else {
+ bigTable.put(
+ attributes.get("table"),
+ attributes.get("column"),
+ attributes.get("key"),
+ attributes.get("value"));
+// }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FileFilter getFileFilter() {
+ return fileFilter;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getPluginName() {
+ return this.getClass().getSimpleName();
+ }
+}
Added: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/ParsingState.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/ParsingState.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/ParsingState.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,40 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins.importer;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public enum ParsingState {
+ START,
+ START_DESCRIBE_DATABASE,
+ END_DESCRIBE_DATABASE,
+ START_DESCRIBE_TABLE,
+ END_DESCRIBE_TABLE,
+ START_DESCRIBE_COLUMN,
+ END_DESCRIBE_COLUMN,
+ START_INSERT_DATA,
+ END_INSERT_DATA,
+ INSERT_DATA,
+ END
+
+// {
+// System.out.println("ParsingState : " +
+// "START : " + START +
+// "START_DESCRIBE_DATABASE : " + START_DESCRIBE_DATABASE +
+// "END_DESCRIBE_DATABASE : " + END_DESCRIBE_DATABASE +
+// "START_DESCRIBE_TABLE : " + START_DESCRIBE_TABLE +
+// "END_DESCRIBE_TABLE : " + END_DESCRIBE_TABLE +
+// "START_DESCRIBE_COLUMN : " + START_DESCRIBE_COLUMN +
+// "END_DESCRIBE_COLUMN : " + END_DESCRIBE_COLUMN +
+// "START_INSERT_DATA : " + START_INSERT_DATA +
+// "END_INSERT_DATA : " + END_INSERT_DATA +
+// "INSERT_DATA : " + INSERT_DATA +
+// "END : " + END
+// );
+// }
+}
Added: trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java
===================================================================
--- trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/java/org/nuiton/mapstoragemanager/plugins/importer/package-info.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,5 @@
+package org.nuiton.mapstoragemanager.plugins.importer;
+/**
+ * @package importer.
+ * Import bigtable database from xml files.
+ */
Added: trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter
===================================================================
--- trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Exporter 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1 @@
+org.nuiton.mapstoragemanager.plugins.exporter.ToXMLXPP3
\ No newline at end of file
Added: trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer
===================================================================
--- trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer (rev 0)
+++ trunk/msm-fromtoXPP3/src/main/resources/META-INF/services/org.nuiton.mapstoragemanager.plugins.Importer 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1 @@
+org.nuiton.mapstoragemanager.plugins.importer.FromXMLXPP3
\ No newline at end of file
Added: trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.dtd
===================================================================
--- trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.dtd (rev 0)
+++ trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.dtd 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,51 @@
+<?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 database SYSTEM "example1.dtd">
+
+ <database>
+ ...
+ </database>
+-->
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT database (describe, insert)>
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT describe (table)*>
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT table (column)*>
+<!ATTLIST table
+ tableName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT column EMPTY>
+<!ATTLIST column
+ columnName CDATA #IMPLIED
+ >
+
+<!--- Put your DTDDoc comment here. -->
+<!ELEMENT insert (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/msm-fromtoXPP3/src/site/doc/xsd/example1.xml
===================================================================
--- trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.xml (rev 0)
+++ trunk/msm-fromtoXPP3/src/site/doc/xsd/example1.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,28 @@
+<?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
+-->
+
+<database>
+ <describe>
+ <table tableName="myLittleHBaseTable">
+ <column columnName="myLittleFamily"/>
+ </table>
+ </describe>
+
+ <insert>
+ <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" />
+ </insert>
+</database>
Added: trunk/msm-fromtoXPP3/src/site/todo.rst
===================================================================
--- trunk/msm-fromtoXPP3/src/site/todo.rst (rev 0)
+++ trunk/msm-fromtoXPP3/src/site/todo.rst 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,6 @@
+
+Function to implement in toXML
+=========================================
+
+ - exportToXml [pending]
+ - importFromXml [pending]
\ No newline at end of file
Added: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/getFile.java
===================================================================
--- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/getFile.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/getFile.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,52 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.mapstoragemanager.plugins;
+
+import java.io.File;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class getFile {
+
+ private static String basedir;
+
+ public static File getTestFile(String path) {
+ return new File(getBasedir(), path);
+ }
+
+ public static File getTestFile(String basedir, String path) {
+ File basedirFile = new File(basedir);
+
+ if (!basedirFile.isAbsolute()) {
+ basedirFile = getTestFile(basedir);
+ }
+
+ return new File(basedirFile, path);
+ }
+
+ public static String getTestPath(String path) {
+ return getTestFile(path).getAbsolutePath();
+ }
+
+ public static String getTestPath(String basedir, String path) {
+ return getTestFile(basedir, path).getAbsolutePath();
+ }
+
+ public static String getBasedir() {
+ if (basedir != null) {
+ return basedir;
+ }
+
+ basedir = System.getProperty("basedir");
+
+ if (basedir == null) {
+ basedir = new File("").getAbsolutePath();
+ }
+
+ return basedir;
+ }
+}
Added: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java
===================================================================
--- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLTest.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,308 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.nuiton.mapstoragemanager.plugins.importer;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.mapstoragemanager.plugins.Importer;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.Plugin;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMapV2;
+import org.nuiton.mapstoragemanager.plugins.getFile;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class FromXMLTest extends TestCase {
+
+ /**
+ * Logger.
+ */
+ private static final Log LOG = LogFactory.getLog(FromXMLTest.class);
+
+// public void testImportFrom() {
+// Assert.fail();
+// }
+
+ /**
+ * Import the database from the file fiveTables.
+ * Verify the content.
+ */
+ public void testImportFromFiveTables() {
+
+ File fiveTables =
+ getFile.getTestFile("/src/test/resources/fiveTables.xml");
+
+ // import fiveTables.
+ Importer importer = new FromXMLXPP3();
+ BigTable bigTable = new BigHashMapV2();
+
+ importer.importFrom(bigTable, fiveTables);
+
+ /************************
+ * Test Tables *
+ ************************/
+ Set<String> tableNamesExpected;
+ {
+ /**
+ * Init tableNames.
+ */
+ tableNamesExpected = new HashSet<String>();
+ tableNamesExpected.add("table1");
+ tableNamesExpected.add("table2");
+ tableNamesExpected.add("table3");
+ tableNamesExpected.add("table4");
+ tableNamesExpected.add("table5");
+ }
+ Set<String> tableNamesActual = bigTable.getTablesNames();
+ assertEquals(tableNamesExpected, tableNamesActual);
+
+
+ for (String tableName : tableNamesActual) {
+ Set<String> columnNamesExpected = new HashSet<String>();
+ assertEquals(columnNamesExpected,
+ bigTable.getColumnsNames(tableName));
+ }
+ }
+
+ /**
+ * Import the database from the file fiveColumns.
+ * Verify the content.
+ */
+ public void testImportFromFiveColumns() {
+
+ File twoTablesFiveColumns =
+ getFile.getTestFile("/src/test/resources/fiveColumns.xml");
+
+ // import fiveTables.
+ Importer importer = new FromXMLXPP3();
+ BigTable bigTable = new BigHashMapV2();
+
+ importer.importFrom(bigTable, twoTablesFiveColumns);
+
+ /************************
+ * Test Tables *
+ ************************/
+ Set<String> tableNamesExpected;
+ {
+ /**
+ * Init tableNames.
+ */
+ tableNamesExpected = new HashSet<String>();
+ tableNamesExpected.add("table1");
+ tableNamesExpected.add("table2");
+ }
+ Set<String> tableNamesActual = bigTable.getTablesNames();
+ assertEquals(tableNamesExpected, tableNamesActual);
+
+ /************************
+ * Test Columns *
+ ************************/
+ Map<String, Set<String>> columnNamesExpected;
+ {
+ /**
+ * Init columnNames.
+ */
+ columnNamesExpected = new HashMap<String, Set<String>>();
+ Set<String> table1ColumnNames = new HashSet<String>();
+ table1ColumnNames.add("column1");
+ table1ColumnNames.add("column2");
+ Set<String> table2ColumnNames = new HashSet<String>();
+ table2ColumnNames.add("column3");
+ table2ColumnNames.add("column4");
+ table2ColumnNames.add("column5");
+ columnNamesExpected.put("table1", table1ColumnNames);
+ columnNamesExpected.put("table2", table2ColumnNames);
+ }
+
+ Set<String> columnNamesActual;
+ for (String tableName : tableNamesActual) {
+ columnNamesActual = bigTable.getColumnsNames(tableName);
+ assertEquals(columnNamesExpected.get(tableName), columnNamesActual);
+ }
+ }
+
+ /**
+ * Import the database from the file tenCells.
+ * Verify the content.
+ */
+ public void testImportFromThreeTenCells() {
+
+ File twoTablesFiveColumns =
+ getFile.getTestFile("/src/test/resources/sixCells.xml");
+
+ // import fiveTables.
+ Importer importer = new FromXMLXPP3();
+ BigTable bigTable = new BigHashMapV2();
+
+ importer.importFrom(bigTable, twoTablesFiveColumns);
+
+ /************************
+ * Test Tables *
+ ************************/
+ Set<String> tableNamesExpected;
+ {
+ /**
+ * Init tableNames.
+ */
+ tableNamesExpected = new HashSet<String>();
+ tableNamesExpected.add("table1");
+ tableNamesExpected.add("table2");
+ }
+ Set<String> tableNamesActual = bigTable.getTablesNames();
+ assertEquals(tableNamesExpected, tableNamesActual);
+
+ /************************
+ * Test Columns *
+ ************************/
+ Map<String, Set<String>> columnNamesExpected;
+ {
+ /**
+ * Init columnNames.
+ */
+ columnNamesExpected = new HashMap<String, Set<String>>();
+ Set<String> table1ColumnNames = new HashSet<String>();
+ table1ColumnNames.add("column1");
+ Set<String> table2ColumnNames = new HashSet<String>();
+ table2ColumnNames.add("column2");
+ table2ColumnNames.add("column3");
+ columnNamesExpected.put("table1", table1ColumnNames);
+ columnNamesExpected.put("table2", table2ColumnNames);
+ }
+
+ Set<String> columnNamesActual;
+ for (String tableName : tableNamesActual) {
+ columnNamesActual = bigTable.getColumnsNames(tableName);
+ assertEquals(columnNamesExpected.get(tableName), columnNamesActual);
+ }
+
+ /************************
+ * Test Cells *
+ ************************/
+ Map<String, Map<String, Map<String, String>>> CellContentExpected;
+ {
+ /**
+ * Init cellContent.
+ */
+ CellContentExpected = new HashMap<String,
+ Map<String, Map<String, String>>>();
+ // table 1.
+ Map<String, Map<String, String>> table1 =
+ new HashMap<String, Map<String, String>>();
+ // column 1.
+ Map<String,String> column1 = new HashMap<String, String>();
+ column1.put("111", "111");
+ table1.put("column1", column1);
+ // table 2.
+ Map<String, Map<String, String>> table2 =
+ new HashMap<String, Map<String, String>>();
+ // column 2.
+ Map<String,String> column2 = new HashMap<String, String>();
+ column2.put("221", "221");
+ column2.put("222", "222");
+ table2.put("column2", column2);
+ // column 3.
+ Map<String,String> column3 = new HashMap<String, String>();
+ column3.put("231", "231");
+ column3.put("232", "232");
+ column3.put("233", "233");
+ table2.put("column3", column3);
+
+ CellContentExpected.put("table1", table1);
+ CellContentExpected.put("table2", table2);
+ LOG.info(CellContentExpected);
+ }
+
+ Set<String> tableKeys;
+ String cellContentActual;
+ String cellContentExpected = null;
+ for (String tableName : tableNamesActual) {
+ columnNamesActual = bigTable.getColumnsNames(tableName);
+ tableKeys = bigTable.getKeys(tableName);
+ for (String columnName : columnNamesActual) {
+ for (String cellKey : tableKeys) {
+
+ try {
+ try{
+ cellContentExpected =
+ CellContentExpected
+ .get(tableName)
+ .get(columnName)
+ .get(cellKey);
+ } catch (NullPointerException ex) {
+ LOG.trace(ex);
+ }
+
+ LOG.info(tableName + ' '
+ + columnName + ' '
+ + cellKey + ' '
+ + cellContentExpected);
+
+ cellContentActual =
+ bigTable.get(tableName, columnName, cellKey);
+ assertEquals(cellContentExpected, cellContentActual);
+ } catch (NoSuchElementException ex) {
+ if(cellContentExpected != null) {
+ LOG.error(ex, ex);
+ Assert.fail();
+ } else {
+ LOG.trace(ex);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Test of getPluginName().
+ */
+ public void testGetPluginName() {
+ Plugin fromXML = new FromXMLXPP3();
+ String expectedPluginName = fromXML.getClass().getSimpleName();
+ String actualPluginName = fromXML.getPluginName();
+ LOG.info("pluginName : {expected,'" + expectedPluginName
+ + "'} - {actual,'" + actualPluginName + "'}");
+ assertEquals(expectedPluginName, actualPluginName);
+ }
+
+ /**
+ * Test of getFileFilter.
+ */
+ public void testGetFileFilter(){
+
+ Importer fromXML = new FromXMLXPP3();
+
+ FileNameExtensionFilter fileFilterExpected
+ = new FileNameExtensionFilter("Fichiers XML", "xml");
+ FileNameExtensionFilter fileFilterActual =
+ (FileNameExtensionFilter) fromXML.getFileFilter();
+
+ /** Same Description */
+ assertEquals(fileFilterExpected.getDescription(),
+ fileFilterActual.getDescription());
+
+ /** get extension Set and assertEquals */
+ Set<String> acceptedExtensionExpected = new HashSet<String>();
+ Set<String> acceptedExtensionActual = new HashSet<String>();
+ for (String extension : fileFilterExpected.getExtensions()) {
+ acceptedExtensionExpected.add(extension);
+ }
+ for (String extension : fileFilterActual.getExtensions()) {
+ acceptedExtensionActual.add(extension);
+ }
+ assertEquals(acceptedExtensionExpected, acceptedExtensionActual);
+ }
+}
Added: trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Main.java
===================================================================
--- trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Main.java (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/java/org/nuiton/mapstoragemanager/plugins/importer/FromXMLXPP3Main.java 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,35 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.nuiton.mapstoragemanager.plugins.importer;
+
+import java.io.File;
+import org.nuiton.mapstoragemanager.plugins.BigTable;
+import org.nuiton.mapstoragemanager.plugins.bighashmapv2.BigHashMapV2;
+import org.nuiton.mapstoragemanager.plugins.getFile;
+
+/**
+ *
+ * @author Dorian Langlais
+ */
+public class FromXMLXPP3Main {
+
+ public static void main (String args[]) {
+
+ BigTable bigTable = new BigHashMapV2();
+
+ if(bigTable==null) {
+ System.out.println("oups");
+ } else {
+ System.out.println("Noups");
+ }
+
+ FromXMLXPP3 myXmlPullApp = new FromXMLXPP3();
+ File importTest =
+ getFile.getTestFile("/src/test/resources/importTest.xml");
+ myXmlPullApp.importFrom(bigTable, importTest);
+
+ }
+}
Added: trunk/msm-fromtoXPP3/src/test/resources/fiveColumns.xml
===================================================================
--- trunk/msm-fromtoXPP3/src/test/resources/fiveColumns.xml (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/resources/fiveColumns.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<database>
+ <describe>
+ <table tableName="table1">
+ <column columnName="column1" />
+ <column columnName="column2" />
+ </table>
+ <table tableName="table2">
+ <column columnName="column3" />
+ <column columnName="column4" />
+ <column columnName="column5" />
+ </table></describe>
+</database>
+
Added: trunk/msm-fromtoXPP3/src/test/resources/fiveTables.xml
===================================================================
--- trunk/msm-fromtoXPP3/src/test/resources/fiveTables.xml (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/resources/fiveTables.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<database>
+ <describe>
+ <table tableName="table1" />
+ <table tableName="table2" />
+ <table tableName="table3" />
+ <table tableName="table4" />
+ <table tableName="table5" />
+ </describe>
+</database>
+
Added: trunk/msm-fromtoXPP3/src/test/resources/importTest.xml
===================================================================
--- trunk/msm-fromtoXPP3/src/test/resources/importTest.xml (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/resources/importTest.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,28 @@
+<?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
+-->
+
+<database>
+ <describe>
+ <table tableName="myLittleHBaseTable">
+ <column columnName="myLittleFamily"/>
+ </table>
+ </describe>
+
+ <insert>
+ <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" />
+ </insert>
+</database>
Added: trunk/msm-fromtoXPP3/src/test/resources/sixCells.xml
===================================================================
--- trunk/msm-fromtoXPP3/src/test/resources/sixCells.xml (rev 0)
+++ trunk/msm-fromtoXPP3/src/test/resources/sixCells.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<database>
+ <describe>
+ <table tableName="table1">
+ <column columnName="column1"/>
+ </table>
+ <table tableName="table2">
+ <column columnName="column2"/>
+ <column columnName="column3"/>
+ </table>
+ </describe>
+ <insert>
+ <element table="table1" column="column1" key="111" version="1" value="111" />
+ <element table="table2" column="column2" key="221" version="1" value="221" />
+ <element table="table2" column="column2" key="222" version="1" value="222" />
+ <element table="table2" column="column3" key="231" version="1" value="231" />
+ <element table="table2" column="column3" key="232" version="1" value="232" />
+ <element table="table2" column="column3" key="233" version="1" value="233" />
+ </insert>
+</database>
+
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-03-07 01:31:28 UTC (rev 194)
+++ trunk/pom.xml 2010-03-08 06:16:04 UTC (rev 195)
@@ -22,6 +22,7 @@
<module>msm-bighashmapV2</module>
<module>msm-hbase</module>
<module>msm-fromtoXML</module>
+ <module>msm-fromtoXPP3</module>
</modules>
<!-- ************************************************************* -->
1
0
r194 - trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui
by dlanglais@users.nuiton.org 07 Mar '10
by dlanglais@users.nuiton.org 07 Mar '10
07 Mar '10
Author: dlanglais
Date: 2010-03-07 02:31:28 +0100 (Sun, 07 Mar 2010)
New Revision: 194
Log:
Suppression Magic Number...
A quoi sert cette classe ?
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MessageThread.java
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MessageThread.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MessageThread.java 2010-03-07 00:40:33 UTC (rev 193)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/ui/gui/MessageThread.java 2010-03-07 01:31:28 UTC (rev 194)
@@ -21,6 +21,11 @@
private static final Log LOG = LogFactory.getLog(MessageThread.class);
/**
+ * Time to refresh.
+ */
+ private static final int TIME_TO_REFRESH = 5000;
+
+ /**
* Constructor.
*/
public MessageThread() {
@@ -31,7 +36,7 @@
public void run() {
MainUI ui = MainUI.getInstance();
try {
- sleep(5000);
+ sleep(TIME_TO_REFRESH);
ui.getMessagesPanel().removeAll();
ui.getMessagesPanel().add(new JLabel(" "));
ui.getMessagesPanel().repaint();
@@ -42,4 +47,3 @@
}
}
-
1
0
r193 - in trunk/msm/src: main/java/org/nuiton/mapstoragemanager/core test/java/org/nuiton/mapstoragemanager/core
by dlanglais@users.nuiton.org 07 Mar '10
by dlanglais@users.nuiton.org 07 Mar '10
07 Mar '10
Author: dlanglais
Date: 2010-03-07 01:40:33 +0100 (Sun, 07 Mar 2010)
New Revision: 193
Log:
Ajout d'un test sur getPlugin(String id).
/!\ Nous aurons un soucis si deux plugins ont le m?\195?\170me nom... (getPluginName()).
Il n'y a pas non plus de gestion de version des plugins...
Modified:
trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java
trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/PluginLoaderTest.java
Modified: trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java
===================================================================
--- trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-03-06 12:47:28 UTC (rev 192)
+++ trunk/msm/src/main/java/org/nuiton/mapstoragemanager/core/PluginLoader.java 2010-03-07 00:40:33 UTC (rev 193)
@@ -151,6 +151,10 @@
pluginsWanted.add(plugin);
}
}
+ } else {
+ for (Plugin plugin : plugins.values()) {
+ pluginsWanted.add(plugin);
+ }
}
return pluginsWanted;
Modified: trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/PluginLoaderTest.java
===================================================================
--- trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/PluginLoaderTest.java 2010-03-06 12:47:28 UTC (rev 192)
+++ trunk/msm/src/test/java/org/nuiton/mapstoragemanager/core/PluginLoaderTest.java 2010-03-07 00:40:33 UTC (rev 193)
@@ -115,13 +115,14 @@
@Override
public String getPluginName() {
- throw new UnsupportedOperationException("Not supported yet.");
+ return "test";
}
};
+ pluginsExpected.clear();
pluginsExpected.add(test);
- pluginsMapActual.put("Test", test);
+ pluginsMapActual.put(test.getPluginName(), test);
pluginsActual = pl.getAllPlugin(Importer.class);
assertEquals(pluginsExpected, pluginsActual);
@@ -134,8 +135,55 @@
assertEquals(pluginsExpected, pluginsActual);
pluginsExpected.clear();
+ pluginsExpected.add(test);
pluginsActual = pl.getAllPlugin(null);
assertEquals(pluginsExpected, pluginsActual);
}
+
+ public void testGetPlugin() {
+ this.setUp();
+
+ Collection<Plugin> pluginsActual = pl.getAllPlugin(null);
+
+ assertNull(pl.getPlugin(null));
+
+ Plugin testImporter = new Importer() {
+
+ @Override
+ public void importFrom(BigTable bigTable, File file) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ @Override
+ public FileFilter getFileFilter() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ @Override
+ public String getPluginName() {
+ return "testImporter";
+ }
+ };
+ Plugin testExporter = new Exporter() {
+
+ @Override
+ public void exportTo(BigTable bigTable, File file) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ @Override
+ public FileFilter getFileFilter() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ @Override
+ public String getPluginName() {
+ return "testExporter";
+ }
+ };
+
+ pluginsMapActual.put(testImporter.getPluginName(), testImporter);
+ pluginsMapActual.put(testExporter.getPluginName(), testExporter);
+
+ assertNull(pl.getPlugin(""));
+ assertEquals(testImporter, pl.getPlugin(testImporter.getPluginName()));
+ assertEquals(testExporter, pl.getPlugin(testExporter.getPluginName()));
+ }
}
1
0