Upgraded jar files. Upgraded Eclipse configuration to Java 8. Migrated

from JodaTime to java.time.
This commit is contained in:
Christian P. MOMON 2018-06-05 14:54:25 +02:00
parent 35c5fbfbf0
commit 5311b4b8ad
44 changed files with 134 additions and 136 deletions

View file

@ -2,25 +2,23 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/> <classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="lib/commons-codec-1.8.jar" sourcepath="lib/commons-codec-1.8-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.8.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.jar"/> <classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.jar"/>
<classpathentry kind="lib" path="lib/joda-time-2.3.jar" sourcepath="lib/joda-time-2.3-sources.jar"/> <classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/commons-io-2.4-sources.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.4.jar" sourcepath="lib/commons-io-2.4-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar" sourcepath="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/hsqldb-2.3.0.jar"/> <classpathentry kind="lib" path="lib/hsqldb-2.3.0.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.4.4.jar" sourcepath="lib/devinsy-strings-0.4.4-sources.zip"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="lib" path="lib/devinsy-xml-0.4.2.jar" sourcepath="lib/devinsy-xml-0.4.2-sources.zip"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.6.jar" sourcepath="lib/commons-io-2.6-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.7.jar" sourcepath="lib/commons-lang3-3.7-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/>
<classpathentry kind="lib" path="lib/devinsy-xml-0.8.2.jar" sourcepath="lib/devinsy-xml-0.8.2-sources.zip"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -1,14 +1,14 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0

View file

@ -2,6 +2,6 @@
<faceted-project> <faceted-project>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project> </faceted-project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-io-2.6.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/commons-lang3-3.7.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/devinsy-xml-0.8.2.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -27,9 +27,9 @@ import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import utils.BuildInformation;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
import utils.BuildInformation;
/** /**
* The Class <code>SikevaDBCLI</code> manages a Command Line Interface for * The Class <code>SikevaDBCLI</code> manages a Command Line Interface for

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -18,8 +18,9 @@
*/ */
package fr.devinsy.sikevadb.core; package fr.devinsy.sikevadb.core;
import java.time.LocalDateTime;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.joda.time.DateTime;
/** /**
* The Class Element. * The Class Element.
@ -31,10 +32,10 @@ public class Element
public static final long NO_ID = -1; public static final long NO_ID = -1;
private long id; private long id;
private DateTime creationDate; private LocalDateTime creationDate;
private DateTime editionDate; private LocalDateTime editionDate;
/* archiveDate field is reserved for journalizer. */ /* archiveDate field is reserved for journalizer. */
private DateTime archiveDate; private LocalDateTime archiveDate;
private String key; private String key;
private String subkey; private String subkey;
private long size; private long size;
@ -72,7 +73,7 @@ public class Element
*/ */
public void archive() public void archive()
{ {
this.archiveDate = DateTime.now(); this.archiveDate = LocalDateTime.now();
} }
/** /**
@ -80,7 +81,7 @@ public class Element
* *
* @return the archive date * @return the archive date
*/ */
public DateTime getArchiveDate() public LocalDateTime getArchiveDate()
{ {
return this.archiveDate; return this.archiveDate;
} }
@ -90,7 +91,7 @@ public class Element
* *
* @return the creation date * @return the creation date
*/ */
public DateTime getCreationDate() public LocalDateTime getCreationDate()
{ {
return this.creationDate; return this.creationDate;
} }
@ -110,7 +111,7 @@ public class Element
* *
* @return the edition date * @return the edition date
*/ */
public DateTime getEditionDate() public LocalDateTime getEditionDate()
{ {
return this.editionDate; return this.editionDate;
} }
@ -171,7 +172,7 @@ public class Element
* @param date * @param date
* the new archive date * the new archive date
*/ */
public void setArchiveDate(final DateTime date) public void setArchiveDate(final LocalDateTime date)
{ {
this.archiveDate = date; this.archiveDate = date;
} }
@ -182,7 +183,7 @@ public class Element
* @param date * @param date
* the new creation date * the new creation date
*/ */
public void setCreationDate(final DateTime date) public void setCreationDate(final LocalDateTime date)
{ {
this.creationDate = date; this.creationDate = date;
} }
@ -204,7 +205,7 @@ public class Element
* @param date * @param date
* the new edition date * the new edition date
*/ */
public void setEditionDate(final DateTime date) public void setEditionDate(final LocalDateTime date)
{ {
this.editionDate = date; this.editionDate = date;
} }
@ -276,7 +277,7 @@ public class Element
setValue(value); setValue(value);
// //
this.editionDate = DateTime.now(); this.editionDate = LocalDateTime.now();
// //
if (value == null) if (value == null)

View file

@ -18,7 +18,7 @@
*/ */
package fr.devinsy.sikevadb.core; package fr.devinsy.sikevadb.core;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Interface SikevaDB. * The Interface SikevaDB.
@ -160,6 +160,15 @@ public interface SikevaDB
*/ */
public void destroy() throws SikevaDBException; public void destroy() throws SikevaDBException;
/**
* Checks if is created.
*
* @return true, if is created
* @throws SikevaDBException
* the SikevaDB exception
*/
public boolean exists() throws SikevaDBException;
/** /**
* Gets an element by key. * Gets an element by key.
* *
@ -217,15 +226,6 @@ public interface SikevaDB
*/ */
public Elements getElements(String key) throws SikevaDBException; public Elements getElements(String key) throws SikevaDBException;
/**
* Gets all the top keys.
*
* @return the keys
* @throws SikevaDBException
* the SikevaDB exception
*/
public StringList getTopKeys() throws SikevaDBException;
/** /**
* Gets all the sub keys of a key. * Gets all the sub keys of a key.
* *
@ -237,6 +237,15 @@ public interface SikevaDB
*/ */
public StringList getSubkeys(String key) throws SikevaDBException; public StringList getSubkeys(String key) throws SikevaDBException;
/**
* Gets all the top keys.
*
* @return the keys
* @throws SikevaDBException
* the SikevaDB exception
*/
public StringList getTopKeys() throws SikevaDBException;
/** /**
* Gets the value of a key. * Gets the value of a key.
* *
@ -296,15 +305,6 @@ public interface SikevaDB
*/ */
public boolean isClosed(); public boolean isClosed();
/**
* Checks if is created.
*
* @return true, if is created
* @throws SikevaDBException
* the SikevaDB exception
*/
public boolean exists() throws SikevaDBException;
/** /**
* Checks if is opened. * Checks if is opened.
* *

View file

@ -23,20 +23,21 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringEscapeUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.util.xml.XMLBadFormatException; import fr.devinsy.xml.XMLBadFormatException;
import fr.devinsy.util.xml.XMLReader; import fr.devinsy.xml.XMLReader;
import fr.devinsy.util.xml.XMLTag; import fr.devinsy.xml.XMLTag;
import fr.devinsy.util.xml.XMLTag.TagType; import fr.devinsy.xml.XMLTag.TagType;
import fr.devinsy.util.xml.XMLWriter; import fr.devinsy.xml.XMLWriter;
import fr.devinsy.util.xml.XMLZipWriter; import fr.devinsy.xml.XMLZipWriter;
/** /**
* The Class XMLSikevaDB represents a XML persister. * The Class XMLSikevaDB represents a XML persister.
@ -77,7 +78,7 @@ public class XMLSikevaDB
public static void export(final OutputStream out, final SikevaDB source) throws SikevaDBException public static void export(final OutputStream out, final SikevaDB source) throws SikevaDBException
{ {
// //
String fileName = "sikevadb-" + DateTime.now().toString("yyyy-MM-dd-HH'h'mm'mn'ss's'") + ".xml.zip"; String fileName = "sikevadb-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH'h'mm'mn'ss's'")) + ".xml.zip";
// //
export(out, source, fileName); export(out, source, fileName);
@ -196,10 +197,10 @@ public class XMLSikevaDB
String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent()); String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent());
int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue()); int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue());
String digest = in.readContentTag("digest").getContent(); String digest = in.readContentTag("digest").getContent();
DateTime creationDate = DateTime.parse(in.readContentTag("creation_date").getContent()); LocalDateTime creationDate = LocalDateTime.parse(in.readContentTag("creation_date").getContent());
DateTime editionDate = DateTime.parse(in.readContentTag("edition_date").getContent()); LocalDateTime editionDate = LocalDateTime.parse(in.readContentTag("edition_date").getContent());
DateTime archiveDate; LocalDateTime archiveDate;
String archiveDateValue = in.readNullableContentTag("archive_date").getContent(); String archiveDateValue = in.readNullableContentTag("archive_date").getContent();
if (archiveDateValue == null) if (archiveDateValue == null)
{ {
@ -207,7 +208,7 @@ public class XMLSikevaDB
} }
else else
{ {
archiveDate = DateTime.parse(archiveDateValue); archiveDate = LocalDateTime.parse(archiveDateValue);
} }
// //
@ -341,8 +342,8 @@ public class XMLSikevaDB
} }
/** /**
* Write in an XML writer the elements of a database, sorting by keys and * Write in an XML writer the elements of a database, sorting by keys and sub
* sub keys. * keys.
* *
* @param out * @param out
* the out * the out

View file

@ -27,11 +27,11 @@ import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import utils.BuildInformation;
import fr.devinsy.sikevadb.core.SikevaDB; import fr.devinsy.sikevadb.core.SikevaDB;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.sikevadb.core.SikevaDBFactory; import fr.devinsy.sikevadb.core.SikevaDBFactory;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
import utils.BuildInformation;
/** /**
* The Class SikevaDBDemo is a demo for SikevaDB. * The Class SikevaDBDemo is a demo for SikevaDB.

View file

@ -24,8 +24,6 @@ import java.io.IOException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils; import org.apache.commons.lang3.SystemUtils;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -36,8 +34,8 @@ import fr.devinsy.sikevadb.core.Elements;
import fr.devinsy.sikevadb.core.OpenedDatabaseException; import fr.devinsy.sikevadb.core.OpenedDatabaseException;
import fr.devinsy.sikevadb.core.SikevaDB; import fr.devinsy.sikevadb.core.SikevaDB;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
import fr.devinsy.util.strings.StringsUtils; import fr.devinsy.strings.StringsUtils;
/** /**
* The Class FileTreeSikevaDB. * The Class FileTreeSikevaDB.
@ -58,15 +56,13 @@ import fr.devinsy.util.strings.StringsUtils;
*/ */
public class FileTreeSikevaDB implements SikevaDB public class FileTreeSikevaDB implements SikevaDB
{ {
private static final Logger logger = LoggerFactory.getLogger(FileTreeSikevaDB.class);
public enum Status public enum Status
{ {
OPENED, OPENED,
CLOSED CLOSED
}; }
private static final Logger logger = LoggerFactory.getLogger(FileTreeSikevaDB.class);
private static final DateTimeFormatter ISOFormatter = ISODateTimeFormat.dateHourMinuteSecondMillis();
private Status status; private Status status;
private String login; private String login;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -22,18 +22,18 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.time.LocalDateTime;
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamException;
import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.sikevadb.core.Element; import fr.devinsy.sikevadb.core.Element;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.util.xml.XMLBadFormatException; import fr.devinsy.xml.XMLBadFormatException;
import fr.devinsy.util.xml.XMLReader; import fr.devinsy.xml.XMLReader;
import fr.devinsy.util.xml.XMLWriter; import fr.devinsy.xml.XMLWriter;
/** /**
* The Class FileTreeSikevaDBTools. * The Class FileTreeSikevaDBTools.
@ -84,11 +84,11 @@ public class FileTreeSikevaDBTools
result.setId(id); result.setId(id);
// private DateTime creationDate; IN // private DateTime creationDate; IN
DateTime creationDate = DateTime.parse(in.readContentTag("creation_date").getContent()); LocalDateTime creationDate = LocalDateTime.parse(in.readContentTag("creation_date").getContent());
result.setCreationDate(creationDate); result.setCreationDate(creationDate);
// private DateTime editionDate; IN // private DateTime editionDate; IN
DateTime editionDate = DateTime.parse(in.readContentTag("edition_date").getContent()); LocalDateTime editionDate = LocalDateTime.parse(in.readContentTag("edition_date").getContent());
result.setEditionDate(editionDate); result.setEditionDate(editionDate);
// private long size; IN // private long size; IN

View file

@ -43,7 +43,7 @@ import fr.devinsy.sikevadb.core.Elements;
import fr.devinsy.sikevadb.core.OpenedDatabaseException; import fr.devinsy.sikevadb.core.OpenedDatabaseException;
import fr.devinsy.sikevadb.core.SikevaDB; import fr.devinsy.sikevadb.core.SikevaDB;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class SQLSikevaDB. * The Class SQLSikevaDB.
@ -53,14 +53,14 @@ import fr.devinsy.util.strings.StringList;
public class SQLSikevaDB implements SikevaDB public class SQLSikevaDB implements SikevaDB
{ {
private static final Logger logger = LoggerFactory.getLogger(SQLSikevaDB.class);;
public enum Status public enum Status
{ {
OPENED, OPENED,
CLOSED CLOSED
}; };
private static final Logger logger = LoggerFactory.getLogger(SQLSikevaDB.class);;
private Status status; private Status status;
private String driverClassname; private String driverClassname;
private String url; private String url;
@ -938,8 +938,8 @@ public class SQLSikevaDB implements SikevaDB
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection.prepareStatement(
.prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL"); "SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1036,8 +1036,8 @@ public class SQLSikevaDB implements SikevaDB
// //
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection.prepareStatement(
.prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?"); "SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY=?");
statement.setString(1, key); statement.setString(1, key);
statement.setString(2, subkey); statement.setString(2, subkey);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
@ -1110,8 +1110,8 @@ public class SQLSikevaDB implements SikevaDB
{ {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection.prepareStatement(
.prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL ORDER BY TOPKEY,SUBKEY ASC"); "SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL ORDER BY TOPKEY,SUBKEY ASC");
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();
while (resultSet.next()) while (resultSet.next())
@ -1177,8 +1177,8 @@ public class SQLSikevaDB implements SikevaDB
{ {
connection = getConnection(); connection = getConnection();
connection.setAutoCommit(true); connection.setAutoCommit(true);
statement = connection statement = connection.prepareStatement(
.prepareStatement("SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL ORDER BY CREATION_DATE ASC"); "SELECT ID,TOPKEY,SUBKEY,VALUE,SIZE,DIGEST,CREATION_DATE,EDITION_DATE,ARCHIVE_DATE FROM sikevadb_elements WHERE ARCHIVE_DATE IS NULL AND TOPKEY=? AND SUBKEY IS NULL ORDER BY CREATION_DATE ASC");
statement.setString(1, key); statement.setString(1, key);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();

View file

@ -22,15 +22,16 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.net.URL; import java.net.URL;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date; import java.util.Date;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class SQLSikevaDBTools. * The Class SQLSikevaDBTools.
@ -129,9 +130,9 @@ public class SQLSikevaDBTools
* the source * the source
* @return the date time * @return the date time
*/ */
public static DateTime toDateTime(final java.sql.Timestamp source) public static LocalDateTime toDateTime(final java.sql.Timestamp source)
{ {
DateTime result; LocalDateTime result;
if (source == null) if (source == null)
{ {
@ -139,7 +140,7 @@ public class SQLSikevaDBTools
} }
else else
{ {
result = new DateTime(source.getTime()); result = LocalDateTime.ofEpochSecond(source.getTime(), 0, ZoneOffset.UTC);
} }
// //
@ -177,7 +178,7 @@ public class SQLSikevaDBTools
* the source * the source
* @return the java.sql. timestamp * @return the java.sql. timestamp
*/ */
public static java.sql.Timestamp toTimestamp(final DateTime source) public static java.sql.Timestamp toTimestamp(final LocalDateTime source)
{ {
java.sql.Timestamp result; java.sql.Timestamp result;
@ -187,7 +188,7 @@ public class SQLSikevaDBTools
} }
else else
{ {
result = new java.sql.Timestamp(source.getMillis()); result = new java.sql.Timestamp(source.toEpochSecond(ZoneOffset.UTC));
} }
// //

View file

@ -19,13 +19,13 @@
package fr.devinsy.sikevadb.filetree; package fr.devinsy.sikevadb.filetree;
import java.io.File; import java.io.File;
import java.time.LocalDateTime;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -35,7 +35,7 @@ import fr.devinsy.sikevadb.core.Element;
import fr.devinsy.sikevadb.core.Elements; import fr.devinsy.sikevadb.core.Elements;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.sikevadb.core.XMLSikevaDB; import fr.devinsy.sikevadb.core.XMLSikevaDB;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class TreeFileSikevaDBTest. * The Class TreeFileSikevaDBTest.
@ -372,9 +372,9 @@ public class TreeFileSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -409,9 +409,9 @@ public class TreeFileSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -446,9 +446,9 @@ public class TreeFileSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -461,9 +461,9 @@ public class TreeFileSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);

View file

@ -18,12 +18,13 @@
*/ */
package fr.devinsy.sikevadb.sql; package fr.devinsy.sikevadb.sql;
import java.time.LocalDateTime;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -32,7 +33,7 @@ import org.junit.Test;
import fr.devinsy.sikevadb.core.Element; import fr.devinsy.sikevadb.core.Element;
import fr.devinsy.sikevadb.core.Elements; import fr.devinsy.sikevadb.core.Elements;
import fr.devinsy.sikevadb.core.SikevaDBException; import fr.devinsy.sikevadb.core.SikevaDBException;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
/** /**
* The Class SQLSikevaDBTest. * The Class SQLSikevaDBTest.
@ -61,9 +62,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -97,9 +98,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now()); element.setCreationDate(LocalDateTime.now());
element.setEditionDate(DateTime.now()); element.setEditionDate(LocalDateTime.now());
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -379,9 +380,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -412,9 +413,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -446,9 +447,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);
@ -461,9 +462,9 @@ public class SQLSikevaDBTest
element.setSubkey(null); element.setSubkey(null);
element.setSize(10); element.setSize(10);
element.setDigest("qsdkfqskjf"); element.setDigest("qsdkfqskjf");
element.setCreationDate(DateTime.now().minusDays(11)); element.setCreationDate(LocalDateTime.now().minusDays(11));
element.setEditionDate(DateTime.now().minusDays(11)); element.setEditionDate(LocalDateTime.now().minusDays(11));
element.setArchiveDate(DateTime.now().minusDays(10)); element.setArchiveDate(LocalDateTime.now().minusDays(10));
element.setValue("bonjour"); element.setValue("bonjour");
database.put(element); database.put(element);