Compare commits

...

23 commits
master ... 1.17

Author SHA1 Message Date
52645283be Build 1.17.0 2024-08-23 12:19:52 +02:00
95feb60b49 Increased version number. 2024-08-23 12:18:01 +02:00
4018f2cc15 Made javadoc review. 2024-08-23 12:17:29 +02:00
5aaf1bf9f4 Set project encoding to UTF-8. 2024-08-23 12:05:52 +02:00
2410c1fa92 Upgraded libs. 2024-08-23 12:04:59 +02:00
9cfa1a36f3 Start migration to Java 17. 2024-08-23 10:51:29 +02:00
a27caf05a5 Migrated to Elcipse 4.16 and Java 11. 2020-08-14 17:59:24 +02:00
42899fd3d6 Step in Java 8 migration. 2020-08-14 17:57:15 +02:00
67592f8e86 Improved lib README. 2018-06-05 18:39:51 +02:00
5311b4b8ad Upgraded jar files. Upgraded Eclipse configuration to Java 8. Migrated
from JodaTime to java.time.
2018-06-05 14:54:25 +02:00
35c5fbfbf0 Init Java 8 migration. 2018-06-04 18:49:28 +02:00
4ee68495db Fixed Eclipse settings. 2018-05-25 09:59:53 +02:00
20842f3770 Cleaned code. 2018-05-25 09:52:11 +02:00
96ec235e9a Replaced devinsy-utils jar with devinsy-strings and devinsy-xml jars. 2018-03-01 01:10:51 +01:00
f68fb63e97 Build 1.0.1 2018-02-28 19:03:09 +01:00
36a8350b53 Fixed database export with unitary test. Added XML export in file. 2018-02-28 17:58:44 +01:00
240c9d28e9 Added export database in file method. 2018-02-28 17:25:25 +01:00
49d906a0b8 Refactored exception in XMLSikevaDB. 2018-02-28 17:17:41 +01:00
e939664d89 Updated headers. 2018-02-28 16:24:59 +01:00
70bb0c74dd Fixed XML export and getKeys methods (thanks Didier). Renamed getKeys
with getTopKeys.
2018-02-28 16:20:16 +01:00
280e8c7a57 Refactored code: added database status check in methods, replaced
NullPointerException with IllegarlArgumentException, fixed SQL create
method, improved code…
2018-02-28 16:04:50 +01:00
615cc5e908 Reviewed Javadoc. 2018-02-28 14:05:14 +01:00
cea1dd448e Reviewed Javadoc fo SikevaDB interface. Renamed remove method with
delete.
2018-02-28 13:28:21 +01:00
68 changed files with 2800 additions and 2149 deletions

View file

@ -2,29 +2,26 @@
<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"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<attributes> <classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<attribute name="owner.project.facets" value="jst.utility"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45">
<attributes> <attributes>
<attribute name="module" value="true"/>
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.jar"/> <classpathentry kind="lib" path="lib/commons-io-2.16.1.jar" sourcepath="lib/commons-io-2.16.1-sources.jar"/>
<classpathentry kind="lib" path="lib/joda-time-2.3.jar" sourcepath="lib/joda-time-2.3-sources.jar"/> <classpathentry kind="lib" path="lib/commons-lang3-3.13.0.jar" sourcepath="lib/commons-lang3-3.13.0-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.4-sources.jar"/> <classpathentry kind="lib" path="lib/devinsy-strings-0.17.0.jar" sourcepath="lib/devinsy-strings-0.17.0-sources.zip"/>
<classpathentry kind="lib" path="lib/commons-io-2.4.jar" sourcepath="lib/commons-io-2.4-sources.jar"/> <classpathentry kind="lib" path="lib/devinsy-xml-0.17.0.jar" sourcepath="lib/devinsy-xml-0.17.0-sources.zip"/>
<classpathentry kind="lib" path="lib/devinsy-utils-0.3.3.jar" sourcepath="lib/devinsy-utils-0.3.3-sources.zip"/> <classpathentry kind="lib" path="lib/commons-codec-1.17.1.jar" sourcepath="lib/commons-codec-1.17.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/> <classpathentry kind="lib" path="lib/mariadb-java-client-3.4.1.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/hsqldb-2.7.3.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar"/> <classpathentry kind="lib" path="lib/Logs/log4j-api-2.23.1.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/> <classpathentry kind="lib" path="lib/Logs/log4j-core-2.23.1.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/> <classpathentry kind="lib" path="lib/Logs/log4j-slf4j2-impl-2.23.1.jar"/>
<classpathentry kind="lib" path="lib/hsqldb-2.3.0.jar"/> <classpathentry kind="lib" path="lib/Logs/slf4j-api-2.0.16.jar"/>
<classpathentry kind="lib" path="lib/commons-text-1.12.0.jar" sourcepath="lib/commons-text-1.12.0-sources.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -1,15 +1,20 @@
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=17
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=17
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.enablePreviewFeatures=disabled
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.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
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_additive_operator=16
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
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -17,22 +22,30 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
@ -53,11 +66,13 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false
org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_html=true
@ -90,6 +105,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -98,6 +114,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -111,11 +128,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@ -145,6 +163,9 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -169,13 +190,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@ -222,6 +247,9 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -258,9 +286,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -281,11 +312,27 @@ org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

@ -11,10 +11,12 @@ cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=true cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=false cleanup.correct_indentation=false
cleanup.format_source_code=true cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=false cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false cleanup.make_private_fields_final=false
@ -29,6 +31,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=fal
cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_trailing_whitespaces_ignore_empty=false
@ -42,8 +45,10 @@ cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true cleanup.remove_unused_private_types=true
cleanup.sort_members=true cleanup.sort_members=true
cleanup.sort_members_all=false cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=true cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false cleanup.use_this_for_non_static_field_access_only_if_necessary=false
@ -54,7 +59,9 @@ cleanup_settings_version=2
eclipse.preferences.version=1 eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_SikevaDB formatter_profile=_SikevaDB
formatter_settings_version=12 formatter_settings_version=13
jautodoc.cleanup.add_header=false
jautodoc.cleanup.replace_header=false
sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_annotations=true

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<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="17"/>
</faceted-project> </faceted-project>

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Sun Feb 04 12:20:07 CET 2018 #Fri Aug 23 12:19:51 CEST 2024
build.number=1 build.number=1

View file

@ -1,3 +1,3 @@
product.name=sikevadb product.name=sikevadb
product.revision.major=1 product.revision.major=1
product.revision.minor=0 product.revision.minor=17

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.

View file

@ -12,4 +12,9 @@ Description of used libraries:
- other: - other:
- commons-codec digest tools - commons-codec digest tools
- commons-io
- commons-lang useful tools (StringUtils...) - commons-lang useful tools (StringUtils...)
- devinsy-strings
- devinsy-xml
- hsqldb
- mysql-jdbc

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.16.1.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.

Binary file not shown.

BIN
lib/commons-text-1.12.0.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.

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

Binary file not shown.

Binary file not shown.

BIN
lib/hsqldb-2.7.3.jar Normal file

Binary file not shown.

Binary file not shown.

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-2024 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.
* *
@ -21,8 +21,8 @@ package fr.devinsy.sikevadb;
import java.io.File; import java.io.File;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.logging.log4j.core.config.Configurator;
import org.apache.log4j.PropertyConfigurator; import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -55,13 +55,13 @@ public final class SikevaDBLauncher
File loggerConfig = new File("log4j.properties"); File loggerConfig = new File("log4j.properties");
if (loggerConfig.exists()) if (loggerConfig.exists())
{ {
PropertyConfigurator.configure(loggerConfig.getAbsolutePath()); Configurator.initialize(null, loggerConfig.getAbsolutePath());
logger.info("Dedicated log configuration done."); logger.info("Dedicated log configuration done.");
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
} }
else else
{ {
BasicConfigurator.configure(); Configurator.initialize(new DefaultConfiguration());
logger.info("Basic log configuration done."); logger.info("Basic log configuration done.");
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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,14 +22,14 @@ package fr.devinsy.sikevadb.cli;
import java.io.File; import java.io.File;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.logging.log4j.core.config.Configurator;
import org.apache.log4j.PropertyConfigurator; import org.apache.logging.log4j.core.config.DefaultConfiguration;
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
@ -76,13 +76,13 @@ public final class SikevaDBCLI
File loggerConfig = new File("log4j.properties"); File loggerConfig = new File("log4j.properties");
if (loggerConfig.exists()) if (loggerConfig.exists())
{ {
PropertyConfigurator.configure(loggerConfig.getAbsolutePath()); Configurator.initialize(null, loggerConfig.getAbsolutePath());
logger.info("Dedicated log configuration done."); logger.info("Dedicated log configuration done.");
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
} }
else else
{ {
BasicConfigurator.configure(); Configurator.initialize(new DefaultConfiguration());
logger.info("Basic log configuration done."); logger.info("Basic log configuration done.");
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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.
* *
@ -20,8 +20,6 @@ package fr.devinsy.sikevadb.core;
/** /**
* The Interface Archiver. * The Interface Archiver.
*
* @author Christian Pierre MOMON
*/ */
public interface Archiver public interface Archiver
{ {
@ -31,17 +29,50 @@ public interface Archiver
SUSPENDED SUSPENDED
} }
/**
* Activate.
*/
void activate(); void activate();
/**
* Archive.
*
* @param element
* the element
* @throws SikevaDBException
* the sikeva DB exception
*/
void archive(Element element) throws SikevaDBException; void archive(Element element) throws SikevaDBException;
/**
* Clear.
*
* @throws SikevaDBException
* the sikeva DB exception
*/
void clear() throws SikevaDBException; void clear() throws SikevaDBException;
/**
* Close.
*/
void close(); void close();
/**
* Checks if is activated.
*
* @return true, if is activated
*/
boolean isActivated(); boolean isActivated();
/**
* Checks if is suspended.
*
* @return true, if is suspended
*/
boolean isSuspended(); boolean isSuspended();
/**
* Suspend.
*/
void suspend(); void suspend();
} }

View file

@ -0,0 +1,70 @@
/*
* Copyright (C) 2018-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
*
* This file is part of SikevaDB, simple key value database.
*
* SikevaDB is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* SikevaDB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.sikevadb.core;
/**
* The Class ClosedDatabaseException.
*/
public class ClosedDatabaseException extends SikevaDBException
{
private static final long serialVersionUID = 8364599416669077052L;
/**
* Instantiates a new closed database exception.
*/
public ClosedDatabaseException()
{
super("Invalid database status for this operation: closed.");
}
/**
* Instantiates a new closed database exception.
*
* @param message
* the message
*/
public ClosedDatabaseException(final String message)
{
super(message);
}
/**
* Instantiates a new closed database exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public ClosedDatabaseException(final String message, final Throwable cause)
{
super(message, cause);
}
/**
* Instantiates a new closed database exception.
*
* @param cause
* the cause
*/
public ClosedDatabaseException(final Throwable cause)
{
super(cause);
}
}

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

@ -0,0 +1,70 @@
/*
* Copyright (C) 2018-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
*
* This file is part of SikevaDB, simple key value database.
*
* SikevaDB is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* SikevaDB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with SikevaDB. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.sikevadb.core;
/**
* The Class OpenedDatabaseException.
*/
public class OpenedDatabaseException extends SikevaDBException
{
private static final long serialVersionUID = 8364599416669077052L;
/**
* Instantiates a new opened database exception.
*/
public OpenedDatabaseException()
{
super("Invalid database status for this operation: opened.");
}
/**
* Instantiates a new opened database exception.
*
* @param message
* the message
*/
public OpenedDatabaseException(final String message)
{
super(message);
}
/**
* Instantiates a new opened database exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public OpenedDatabaseException(final String message, final Throwable cause)
{
super(message, cause);
}
/**
* Instantiates a new opened database exception.
*
* @param cause
* the cause
*/
public OpenedDatabaseException(final Throwable cause)
{
super(cause);
}
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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,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.
@ -27,89 +27,466 @@ import fr.devinsy.util.strings.StringList;
*/ */
public interface SikevaDB public interface SikevaDB
{ {
/**
* Archiver.
*
* @return the archiver
* @throws SikevaDBException
* the sikeva DB exception
*/
public Archiver archiver() throws SikevaDBException; public Archiver archiver() throws SikevaDBException;
/**
* Delete all elements of current opened database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void clear() throws SikevaDBException; public void clear() throws SikevaDBException;
/**
* Close the current database session.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void close() throws SikevaDBException; public void close() throws SikevaDBException;
/**
* Count of elements in current database.
*
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements() throws SikevaDBException; public long countOfElements() throws SikevaDBException;
/**
* Count of elements by key.
*
* @param key
* the key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements(String key) throws SikevaDBException; public long countOfElements(String key) throws SikevaDBException;
/**
* Count of elements by key and sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements(String key, long subkey) throws SikevaDBException; public long countOfElements(String key, long subkey) throws SikevaDBException;
/**
* Count of elements by key and sub key.
*
* @param key
* the key
* @param subkey
* the subkey
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long countOfElements(String key, String subkey) throws SikevaDBException; public long countOfElements(String key, String subkey) throws SikevaDBException;
/**
* Creates the database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
public void create() throws SikevaDBException; public void create() throws SikevaDBException;
/**
* Delete an database element with its key.
*
* @param key
* the key
* @throws SikevaDBException
* the SikevaDB exception
*/
void delete(final String key) throws SikevaDBException;
/**
* Delete an database element with its key and subkey.
*
* @param key
* the key
* @param subkey
* the sub key
* @throws SikevaDBException
* the SikevaDB exception
*/
void delete(final String key, final long subkey) throws SikevaDBException;
/**
* Delete an database element with its key and subkey.
*
* @param key
* the key
* @param subkey
* the sub key
* @throws SikevaDBException
* the SikevaDB exception
*/
void delete(final String key, final String subkey) throws SikevaDBException;
/**
* Delete many database elements from key and sub keys.
*
* @param key
* the key
* @param subkeys
* the subkeys
* @throws SikevaDBException
* the SikevaDB exception
*/
void deleteMany(final String key, final String... subkeys) throws SikevaDBException;
/**
* Destroy.
*
* @throws SikevaDBException
* the sikeva DB exception
*/
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.
*
* @param key
* the key
* @return the element
* @throws SikevaDBException
* the SikevaDB exception
*/
public Element getElement(String key) throws SikevaDBException; public Element getElement(String key) throws SikevaDBException;
/**
* Gets an element by key and sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the element
* @throws SikevaDBException
* the SikevaDB exception
*/
public Element getElement(String key, long subkey) throws SikevaDBException; public Element getElement(String key, long subkey) throws SikevaDBException;
/**
* Gets an element by key and sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the element
* @throws SikevaDBException
* the SikevaDB exception
*/
public Element getElement(String key, String subkey) throws SikevaDBException; public Element getElement(String key, String subkey) throws SikevaDBException;
/**
* Gets all elements in current database.
*
* @return the elements
* @throws SikevaDBException
* the SikevaDB exception
*/
public Elements getElements() throws SikevaDBException; public Elements getElements() throws SikevaDBException;
/**
* Gets all elements of a top key.
*
* @param key
* the key
* @return the elements
* @throws SikevaDBException
* the SikevaDB exception
*/
public Elements getElements(String key) throws SikevaDBException; public Elements getElements(String key) throws SikevaDBException;
public fr.devinsy.util.strings.StringList getKeys() throws SikevaDBException; /**
* Gets all the sub keys of a key.
*
* @param key
* the key
* @return the subkeys
* @throws SikevaDBException
* the SikevaDB exception
*/
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.
*
* @param key
* the key
* @return the value
* @throws SikevaDBException
* the SikevaDB exception
*/
public String getValue(String key) throws SikevaDBException; public String getValue(String key) throws SikevaDBException;
/**
* Gets the value of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the value
* @throws SikevaDBException
* the SikevaDB exception
*/
public String getValue(String key, long subkey) throws SikevaDBException; public String getValue(String key, long subkey) throws SikevaDBException;
/**
* Gets the value of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the value
* @throws SikevaDBException
* the SikevaDB exception
*/
public String getValue(String key, String subkey) throws SikevaDBException; public String getValue(String key, String subkey) throws SikevaDBException;
/**
* Gets the values.
*
* @param key
* the key
* @return the values
* @throws SikevaDBException
* the sikeva DB exception
*/
public StringList getValues(String key) throws SikevaDBException; public StringList getValues(String key) throws SikevaDBException;
/**
* Checks if is archive activated.
*
* @return true, if is archive activated
*/
boolean isArchiveActivated(); boolean isArchiveActivated();
/**
* Checks if is archive suspended.
*
* @return true, if is archive suspended
*/
boolean isArchiveSuspended(); boolean isArchiveSuspended();
/**
* Checks if is closed.
*
* @return true, if is closed
*/
public boolean isClosed(); public boolean isClosed();
public boolean isCreated() throws SikevaDBException; /**
* Checks if is opened.
*
* @return true, if is opened
*/
public boolean isOpened(); public boolean isOpened();
/**
* Returns the memory size of the elements in database.
*
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize() throws SikevaDBException; public long memorySize() throws SikevaDBException;
/**
* Returns the memory size of elements of a key.
*
* @param key
* the key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize(String key) throws SikevaDBException; public long memorySize(String key) throws SikevaDBException;
/**
* Returns the memory size of element of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize(String key, long subkey) throws SikevaDBException; public long memorySize(String key, long subkey) throws SikevaDBException;
/**
* Returns the memory size of element of a key and a sub key.
*
* @param key
* the key
* @param subkey
* the sub key
* @return the long
* @throws SikevaDBException
* the SikevaDB exception
*/
public long memorySize(String key, String subkey) throws SikevaDBException; public long memorySize(String key, String subkey) throws SikevaDBException;
/**
* Open a database.
*
* @throws SikevaDBException
* the SikevaDB exception
*/
void open() throws SikevaDBException; void open() throws SikevaDBException;
/**
* Put an element in database.
*
* @param element
* the element
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(Element element) throws SikevaDBException; void put(Element element) throws SikevaDBException;
/**
* Put a value for a key and a sub key in current opened database.
*
* @param key
* the key
* @param subkey
* the sub key
* @param value
* the value
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(String key, long subkey, String value) throws SikevaDBException; void put(String key, long subkey, String value) throws SikevaDBException;
/**
* Put a value for a key in current opened database.
*
* @param key
* the key
* @param value
* the value
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(String key, String value) throws SikevaDBException; void put(String key, String value) throws SikevaDBException;
/**
* Put a value for a key and a sub key in current opened database.
*
* @param key
* the key
* @param subkey
* the sub key
* @param value
* the value
* @throws SikevaDBException
* the SikevaDB exception
*/
void put(String key, String subkey, String value) throws SikevaDBException; void put(String key, String subkey, String value) throws SikevaDBException;
void remove(final String key) throws SikevaDBException; /**
* Rename a key.
void remove(final String key, final long subkey) throws SikevaDBException; *
* @param oldKey
void remove(final String key, final String subkey) throws SikevaDBException; * the old key
* @param newKey
void removeMany(final String key, final String... subkeys) throws SikevaDBException; * the new key
* @throws SikevaDBException
* the SikevaDB exception
*/
void renameKey(final String oldKey, final String newKey) throws SikevaDBException; void renameKey(final String oldKey, final String newKey) throws SikevaDBException;
/**
* Rename a sub key.
*
* @param key
* the key
* @param oldSubKey
* the old sub key
* @param newSubKey
* the new sub key
* @throws SikevaDBException
* the SikevaDB exception
*/
void renameSubkey(final String key, final long oldSubKey, final long newSubKey) throws SikevaDBException; void renameSubkey(final String key, final long oldSubKey, final long newSubKey) throws SikevaDBException;
/**
* Rename a sub key.
*
* @param key
* the key
* @param oldSubKey
* the old sub key
* @param newSubKey
* the new sub key
* @throws SikevaDBException
* the SikevaDB exception
*/
void renameSubkey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException; void renameSubkey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException;
/**
* Replace a substring in a value of a key.
*
* @param key
* the key
* @param tokens
* the tokens
* @throws SikevaDBException
* the SikevaDB exception
*/
void replaceInValue(final String key, final String... tokens) throws SikevaDBException; void replaceInValue(final String key, final String... tokens) throws SikevaDBException;
/**
* Replace a substring in values of all sub keys of a key.
*
* @param key
* the key
* @param tokens
* the tokens
* @throws SikevaDBException
* the SikevaDB exception
*/
void replaceInValues(final String key, final String... tokens) throws SikevaDBException; void replaceInValues(final String key, final String... tokens) throws SikevaDBException;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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.
* *
@ -19,73 +19,90 @@
package fr.devinsy.sikevadb.core; package fr.devinsy.sikevadb.core;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
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.
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
*/ */
public class XMLSikevaDB public class XMLSikevaDB
{ {
private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class); private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class);
/** /**
* Saves a net in a file. * Export.
* *
* @param out * @param out
* the out * the out
* @param source * @param source
* Source. * the source
* * @throws SikevaDBException
* @throws Exception * the sikeva DB exception
* the exception * @throws FileNotFoundException
* the file not found exception
*/ */
public static void export(final OutputStream out, final SikevaDB source) throws Exception public static void export(final File out, final SikevaDB source) throws SikevaDBException, FileNotFoundException
{
export(new FileOutputStream(out), source, out.getName());
}
/**
* Export.
*
* @param out
* the out
* @param source
* the source
* @throws SikevaDBException
* the SikevaDB exception
*/
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);
} }
/** /**
* Saves a net in a file. * Export.
* *
* @param out * @param out
* the out * the out
* @param source * @param source
* Source. * the source
* @param fileName * @param fileName
* the file name * the file name
* * @throws SikevaDBException
* @throws Exception * the SikevaDB exception
* the exception
*/ */
public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws Exception public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws SikevaDBException
{ {
if (out == null) if (out == null)
{ {
throw new NullPointerException("out is null."); throw new IllegalArgumentException("out is null.");
} }
else if (source == null) else if (source == null)
{ {
throw new NullPointerException("source is null."); throw new IllegalArgumentException("source is null.");
} }
else if (fileName == null) else if (fileName == null)
{ {
@ -105,11 +122,22 @@ public class XMLSikevaDB
// //
write(target, source); write(target, source);
} }
catch (IOException exception)
{
throw new SikevaDBException("Problem writing element.", exception);
}
finally finally
{ {
if (target != null) if (target != null)
{ {
target.close(); try
{
target.close();
}
catch (IOException exception)
{
logger.warn("Problem closing stream.", exception);
}
} }
} }
} }
@ -122,12 +150,11 @@ public class XMLSikevaDB
* the database * the database
* @param file * @param file
* the file * the file
*
* @throws Exception
* the exception
*/ */
public static void importData(final SikevaDB database, final File file) throws Exception public static void importData(final SikevaDB database, final File file)
{ {
// TODO
// XMLReader in = null; // XMLReader in = null;
// try { // try {
// in = new XMLZipReader(file); // in = new XMLZipReader(file);
@ -145,58 +172,66 @@ public class XMLSikevaDB
* @param in * @param in
* the in * the in
* @return the element * @return the element
* * @throws SikevaDBException
* @throws XMLStreamException * the sikeva DB exception
* the XML stream exception
* @throws XMLBadFormatException
* the XML bad format exception
*/ */
public static Element readElement(final XMLReader in) throws XMLStreamException, XMLBadFormatException public static Element readElement(final XMLReader in) throws SikevaDBException
{ {
Element result; Element result;
// try
XMLTag tag = in.readStartTag("element");
//
{ {
// //
long id = Long.parseLong(tag.attributes().getByLabel("id").getValue()); XMLTag tag = in.readStartTag("element");
String key = StringEscapeUtils.unescapeXml(in.readContentTag("key").getContent());
String subkey = StringEscapeUtils.unescapeXml(in.readNullableContentTag("subkey").getContent());
String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent());
int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue());
String digest = in.readContentTag("digest").getContent();
DateTime creationDate = DateTime.parse(in.readContentTag("creation_date").getContent());
DateTime editionDate = DateTime.parse(in.readContentTag("edition_date").getContent());
DateTime archiveDate; //
String archiveDateValue = in.readNullableContentTag("archive_date").getContent();
if (archiveDateValue == null)
{ {
archiveDate = null; //
} long id = Long.parseLong(tag.attributes().getByLabel("id").getValue());
else String key = StringEscapeUtils.unescapeXml(in.readContentTag("key").getContent());
{ String subkey = StringEscapeUtils.unescapeXml(in.readNullableContentTag("subkey").getContent());
archiveDate = DateTime.parse(archiveDateValue); String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent());
int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue());
String digest = in.readContentTag("digest").getContent();
LocalDateTime creationDate = LocalDateTime.parse(in.readContentTag("creation_date").getContent());
LocalDateTime editionDate = LocalDateTime.parse(in.readContentTag("edition_date").getContent());
LocalDateTime archiveDate;
String archiveDateValue = in.readNullableContentTag("archive_date").getContent();
if (archiveDateValue == null)
{
archiveDate = null;
}
else
{
archiveDate = LocalDateTime.parse(archiveDateValue);
}
//
result = new Element();
result.setId(id);
result.setKey(key);
result.setSubkey(subkey);
result.setValue(value);
result.setSize(size);
result.setDigest(digest);
result.setCreationDate(creationDate);
result.setEditionDate(editionDate);
result.setArchiveDate(archiveDate);
} }
// //
result = new Element(); in.readEndTag("element");
}
result.setId(id); catch (XMLStreamException exception)
result.setKey(key); {
result.setSubkey(subkey); throw new SikevaDBException("Problem reading element.", exception);
result.setValue(value); }
result.setSize(size); catch (XMLBadFormatException exception)
result.setDigest(digest); {
result.setCreationDate(creationDate); throw new SikevaDBException("Problem reading element.", exception);
result.setEditionDate(editionDate);
result.setArchiveDate(archiveDate);
} }
//
in.readEndTag("element");
// //
return result; return result;
@ -209,30 +244,36 @@ public class XMLSikevaDB
* the target * the target
* @param in * @param in
* the in * the in
* * @throws SikevaDBException
* @throws Exception * the sikeva DB exception
* the exception
*/ */
public static void readElements(final SikevaDB target, final XMLReader in) throws Exception public static void readElements(final SikevaDB target, final XMLReader in) throws SikevaDBException
{ {
// try
XMLTag list = in.readListTag("elements");
//
if (list.getType() != TagType.EMPTY)
{ {
while (in.hasNextStartTag("element")) XMLTag list = in.readListTag("elements");
{
//
Element element = readElement(in);
//
target.put(element);
}
// //
in.readEndTag("elements"); if (list.getType() != TagType.EMPTY)
{
//
while (in.hasNextStartTag("element"))
{
Element element = readElement(in);
target.put(element);
}
//
in.readEndTag("elements");
}
}
catch (XMLStreamException exception)
{
throw new SikevaDBException("Problem reading element.", exception);
}
catch (XMLBadFormatException exception)
{
throw new SikevaDBException("Problem reading element.", exception);
} }
} }
@ -249,11 +290,11 @@ public class XMLSikevaDB
if (out == null) if (out == null)
{ {
throw new NullPointerException("out is null."); throw new IllegalArgumentException("Parameter out is null.");
} }
else if (source == null) else if (source == null)
{ {
throw new NullPointerException("element is null."); throw new IllegalArgumentException("Parameter element is null.");
} }
else else
{ {
@ -293,21 +334,21 @@ public class XMLSikevaDB
} }
/** /**
* Write. * Write in an XML writer the elements of a database, sorting by keys and
* sub keys.
* *
* @param out * @param out
* the out * the out
* @param source * @param source
* the source * the source
* * @throws SikevaDBException
* @throws Exception * the sikeva DB exception
* the exception
*/ */
public static void write(final XMLWriter out, final SikevaDB source) throws Exception public static void write(final XMLWriter out, final SikevaDB source) throws SikevaDBException
{ {
if (out == null) if (out == null)
{ {
throw new NullPointerException("out is null."); throw new IllegalArgumentException("out is null.");
} }
else if (source == null) else if (source == null)
{ {
@ -317,19 +358,19 @@ public class XMLSikevaDB
{ {
out.writeStartTag("elements"); out.writeStartTag("elements");
for (String key : source.getKeys()) for (String topkey : source.getTopKeys().sort())
{ {
// //
Elements elements = source.getElements(key); Element topElement = source.getElement(topkey);
for (Element element : elements) if (topElement != null)
{ {
write(out, element); write(out, topElement);
} }
// //
for (String subkey : source.getSubkeys(key)) for (String subkey : source.getSubkeys(topkey).sort())
{ {
Element subElement = source.getElement(key, subkey); Element subElement = source.getElement(topkey, subkey);
write(out, subElement); write(out, subElement);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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,16 +22,16 @@ package fr.devinsy.sikevadb.demo;
import java.io.File; import java.io.File;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.logging.log4j.core.config.Configurator;
import org.apache.log4j.PropertyConfigurator; import org.apache.logging.log4j.core.config.DefaultConfiguration;
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.
@ -62,7 +62,7 @@ public final class SikevaDBDemo
File homeDirectory = new File("/tmp/footest"); File homeDirectory = new File("/tmp/footest");
database = SikevaDBFactory.get(homeDirectory); database = SikevaDBFactory.get(homeDirectory);
if (database.isCreated()) if (database.exists())
{ {
database.destroy(); database.destroy();
} }
@ -87,14 +87,14 @@ public final class SikevaDBDemo
} }
// //
database.remove("alpha"); database.delete("alpha");
if (database.getValue("alpha") == null) if (database.getValue("alpha") == null)
{ {
System.out.println("alpha is correctly removed."); System.out.println("alpha is correctly deleted.");
} }
else else
{ {
System.out.println("alpha is NOT correctly removed."); System.out.println("alpha is NOT correctly deleted.");
} }
} }
@ -116,14 +116,14 @@ public final class SikevaDBDemo
} }
// //
database.remove("victor", 5); database.delete("victor", 5);
if (database.getValue("victor", 5) == null) if (database.getValue("victor", 5) == null)
{ {
System.out.println("(victor, 5) is correctly removed."); System.out.println("(victor, 5) is correctly deleted.");
} }
else else
{ {
System.out.println("(victor, 5) is NOT correctly removed."); System.out.println("(victor, 5) is NOT correctly deleted.");
} }
} }
@ -136,7 +136,7 @@ public final class SikevaDBDemo
} }
finally finally
{ {
if ((database != null) && (database.isCreated())) if ((database != null) && (database.exists()))
{ {
database.destroy(); database.destroy();
} }
@ -171,13 +171,13 @@ public final class SikevaDBDemo
File loggerConfig = new File("log4j.properties"); File loggerConfig = new File("log4j.properties");
if (loggerConfig.exists()) if (loggerConfig.exists())
{ {
PropertyConfigurator.configure(loggerConfig.getAbsolutePath()); Configurator.initialize(null, loggerConfig.getAbsolutePath());
logger.info("Dedicated log configuration done."); logger.info("Dedicated log configuration done.");
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
} }
else else
{ {
BasicConfigurator.configure(); Configurator.initialize(new DefaultConfiguration());
logger.info("Basic log configuration done."); logger.info("Basic log configuration done.");
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile()); logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
} }

File diff suppressed because it is too large Load diff

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

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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,10 +27,7 @@ import fr.devinsy.sikevadb.core.SikevaDBException;
/** /**
* The Class SQLArchiver. * The Class SQLArchiver.
*
* @author Christian Pierre MOMON
*/ */
public class SQLArchiver implements Archiver public class SQLArchiver implements Archiver
{ {
private static final Logger logger = LoggerFactory.getLogger(SQLArchiver.class);; private static final Logger logger = LoggerFactory.getLogger(SQLArchiver.class);;

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr> * Copyright (C) 2013-2024 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,15 +22,17 @@ 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.nio.charset.StandardCharsets;
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.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.FileTools; import fr.devinsy.strings.StringList;
import fr.devinsy.util.strings.StringList;
/** /**
* The Class SQLSikevaDBTools. * The Class SQLSikevaDBTools.
@ -54,7 +56,7 @@ public class SQLSikevaDBTools
{ {
StringList result; StringList result;
String script = FileTools.load(source); String script = IOUtils.toString(source, StandardCharsets.UTF_8);
result = splitSQLCommands(script); result = splitSQLCommands(script);
@ -98,22 +100,16 @@ public class SQLSikevaDBTools
{ {
if ((StringUtils.isNotBlank(line)) && (!line.startsWith("--"))) if ((StringUtils.isNotBlank(line)) && (!line.startsWith("--")))
{ {
//
if (line.endsWith(";")) if (line.endsWith(";"))
{ {
//
sql.append(line.substring(0, line.length() - 1)); sql.append(line.substring(0, line.length() - 1));
//
result.add(sql.toString()); result.add(sql.toString());
//
sql.clear(); sql.clear();
} }
else else
{ {
//
sql.append(line).append(' '); sql.append(line).append(' ');
} }
} }
@ -135,9 +131,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)
{ {
@ -145,7 +141,9 @@ public class SQLSikevaDBTools
} }
else else
{ {
result = new DateTime(source.getTime()); long seconds = source.getTime() / 1000;
long nanos = (source.getTime() - seconds * 1000) * 1000000;
result = LocalDateTime.ofEpochSecond(seconds, (int) nanos, ZoneOffset.UTC);
} }
// //
@ -169,7 +167,7 @@ public class SQLSikevaDBTools
} }
else else
{ {
result = new java.sql.Timestamp(source.getTime()); result = new java.sql.Timestamp(source.getTime() * 1000);
} }
// //
@ -183,7 +181,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;
@ -193,7 +191,9 @@ public class SQLSikevaDBTools
} }
else else
{ {
result = new java.sql.Timestamp(source.getMillis()); long seconds = source.toEpochSecond(ZoneOffset.UTC);
long milliseconds = source.getNano() / 1000000;
result = new java.sql.Timestamp(seconds * 1000 + milliseconds);
} }
// //

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON, DEVINSY * Copyright (C) 2013-2024 Christian Pierre MOMON, DEVINSY
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -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.logging.log4j.Level;
import org.apache.log4j.Level; import org.apache.logging.log4j.core.config.Configurator;
import org.apache.log4j.Logger; import org.apache.logging.log4j.core.config.DefaultConfiguration;
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;
@ -34,7 +34,8 @@ 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.sikevadb.core.XMLSikevaDB;
import fr.devinsy.strings.StringList;
/** /**
* The Class TreeFileSikevaDBTest. * The Class TreeFileSikevaDBTest.
@ -46,6 +47,38 @@ public class TreeFileSikevaDBTest
private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TreeFileSikevaDBTest.class); private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TreeFileSikevaDBTest.class);
private static FileTreeSikevaDB database; private static FileTreeSikevaDB database;
@Test
public void testExport01() throws Exception
{
//
logger.debug("===== test starting...");
database.clear();
database.put("alpha01", "qlskjfmlqja");
database.put("alpha01", "qlskjfmlqjb");
database.put("alpha02", "qlskjfmlqj");
database.put("alpha03", "qlskjfmlqj");
database.put("alpha04", "qlskjfmlqj");
database.put("alpha05", "qlskjfmlqj");
database.delete("alpha03");
database.put("alpha01s", "bravo1", "qlskjfmlqja");
database.put("alpha01s", "bravo1", "qlskjfmlqjb");
database.put("alpha01s", "bravo2", "qlskjfmlqj");
database.put("alpha01s", "bravo3", "qlskjfmlqj");
database.put("alpha01s", "bravo4", "qlskjfmlqj");
database.put("alpha01s", "bravo5", "qlskjfmlqj");
database.delete("alpha01s", "bravo3");
File file = File.createTempFile("sikevadb-", ".tmp");
XMLSikevaDB.export(file, database);
Assert.assertTrue(file.exists());
file.delete();
//
logger.debug("===== test done.");
}
/** /**
* Test get keyse 01. * Test get keyse 01.
* *
@ -106,9 +139,9 @@ public class TreeFileSikevaDBTest
database.put("alpha01s", "bravo4", "qlskjfmlqj"); database.put("alpha01s", "bravo4", "qlskjfmlqj");
database.put("alpha01s", "bravo5", "qlskjfmlqj"); database.put("alpha01s", "bravo5", "qlskjfmlqj");
StringList keys = database.getKeys(); StringList keys = database.getTopKeys();
Assert.assertEquals(5, keys.size()); Assert.assertEquals(6, keys.size());
Assert.assertTrue(keys.contains("alpha03")); Assert.assertTrue(keys.contains("alpha03"));
Assert.assertEquals(0, database.getSubkeys("alpha03s").size()); Assert.assertEquals(0, database.getSubkeys("alpha03s").size());
Assert.assertEquals(5, database.getSubkeys("alpha01s").size()); Assert.assertEquals(5, database.getSubkeys("alpha01s").size());
@ -339,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);
@ -376,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);
@ -413,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);
@ -428,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);
@ -544,7 +577,7 @@ public class TreeFileSikevaDBTest
Assert.assertEquals(12, database.countOfElements()); Assert.assertEquals(12, database.countOfElements());
database.removeMany("alpha01", "bravo", "delta", "fox"); database.deleteMany("alpha01", "bravo", "delta", "fox");
Assert.assertEquals(9, database.countOfElements()); Assert.assertEquals(9, database.countOfElements());
@ -609,14 +642,14 @@ public class TreeFileSikevaDBTest
database.put("alpha03", "qlskjfmlqj"); database.put("alpha03", "qlskjfmlqj");
database.put("alpha04", "qlskjfmlqj"); database.put("alpha04", "qlskjfmlqj");
database.put("alpha05", "qlskjfmlqj"); database.put("alpha05", "qlskjfmlqj");
database.remove("alpha03"); database.delete("alpha03");
database.put("alpha01s", "bravo1", "qlskjfmlqja"); database.put("alpha01s", "bravo1", "qlskjfmlqja");
database.put("alpha01s", "bravo1", "qlskjfmlqjb"); database.put("alpha01s", "bravo1", "qlskjfmlqjb");
database.put("alpha01s", "bravo2", "qlskjfmlqj"); database.put("alpha01s", "bravo2", "qlskjfmlqj");
database.put("alpha01s", "bravo3", "qlskjfmlqj"); database.put("alpha01s", "bravo3", "qlskjfmlqj");
database.put("alpha01s", "bravo4", "qlskjfmlqj"); database.put("alpha01s", "bravo4", "qlskjfmlqj");
database.put("alpha01s", "bravo5", "qlskjfmlqj"); database.put("alpha01s", "bravo5", "qlskjfmlqj");
database.remove("alpha01s", "bravo3"); database.delete("alpha01s", "bravo3");
// System.out.println(database.countOfElements() + " " + // System.out.println(database.countOfElements() + " " +
// database.countOfArchivedElements() + " " + // database.countOfArchivedElements() + " " +
@ -671,6 +704,7 @@ public class TreeFileSikevaDBTest
if (database != null) if (database != null)
{ {
database.close(); database.close();
database.destroy();
} }
} }
@ -683,8 +717,8 @@ public class TreeFileSikevaDBTest
@BeforeClass @BeforeClass
public static void beforeClass() throws SikevaDBException public static void beforeClass() throws SikevaDBException
{ {
BasicConfigurator.configure(); Configurator.initialize(new DefaultConfiguration());
Logger.getRootLogger().setLevel(Level.DEBUG); Configurator.setRootLevel(Level.DEBUG);
// Add ?profileSQL=true to generate huge logs. // Add ?profileSQL=true to generate huge logs.
@ -695,7 +729,7 @@ public class TreeFileSikevaDBTest
File homeDirectory = new File("/tmp/footest"); File homeDirectory = new File("/tmp/footest");
database = new FileTreeSikevaDB(homeDirectory, null, null); database = new FileTreeSikevaDB(homeDirectory, null, null);
if (!database.isCreated()) if (!database.exists())
{ {
database.create(); database.create();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON, DEVINSY * Copyright (C) 2013-2024 Christian Pierre MOMON, DEVINSY
* *
* This file is part of SikevaDB, simple key value database. * This file is part of SikevaDB, simple key value database.
* *
@ -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.logging.log4j.Level;
import org.apache.log4j.Level; import org.apache.logging.log4j.core.config.Configurator;
import org.apache.log4j.Logger; import org.apache.logging.log4j.core.config.DefaultConfiguration;
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);
@ -170,7 +171,7 @@ public class SQLSikevaDBTest
database.put("alpha01", "bravo4", "qlskjfmlqj"); database.put("alpha01", "bravo4", "qlskjfmlqj");
database.put("alpha01", "bravo5", "qlskjfmlqj"); database.put("alpha01", "bravo5", "qlskjfmlqj");
StringList keys = database.getKeys(); StringList keys = database.getTopKeys();
Assert.assertEquals(5, keys.size()); Assert.assertEquals(5, keys.size());
Assert.assertTrue(keys.contains("alpha03")); Assert.assertTrue(keys.contains("alpha03"));
@ -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);
@ -567,7 +568,7 @@ public class SQLSikevaDBTest
Assert.assertEquals(12, database.countOfElements()); Assert.assertEquals(12, database.countOfElements());
database.removeMany("alpha01", "bravo", "delta", "fox"); database.deleteMany("alpha01", "bravo", "delta", "fox");
Assert.assertEquals(9, database.countOfElements()); Assert.assertEquals(9, database.countOfElements());
@ -626,14 +627,14 @@ public class SQLSikevaDBTest
database.put("alpha03", "qlskjfmlqj"); database.put("alpha03", "qlskjfmlqj");
database.put("alpha04", "qlskjfmlqj"); database.put("alpha04", "qlskjfmlqj");
database.put("alpha05", "qlskjfmlqj"); database.put("alpha05", "qlskjfmlqj");
database.remove("alpha03"); database.delete("alpha03");
database.put("alpha01", "bravo1", "qlskjfmlqja"); database.put("alpha01", "bravo1", "qlskjfmlqja");
database.put("alpha01", "bravo1", "qlskjfmlqjb"); database.put("alpha01", "bravo1", "qlskjfmlqjb");
database.put("alpha01", "bravo2", "qlskjfmlqj"); database.put("alpha01", "bravo2", "qlskjfmlqj");
database.put("alpha01", "bravo3", "qlskjfmlqj"); database.put("alpha01", "bravo3", "qlskjfmlqj");
database.put("alpha01", "bravo4", "qlskjfmlqj"); database.put("alpha01", "bravo4", "qlskjfmlqj");
database.put("alpha01", "bravo5", "qlskjfmlqj"); database.put("alpha01", "bravo5", "qlskjfmlqj");
database.remove("alpha01", "bravo3"); database.delete("alpha01", "bravo3");
// System.out.println(database.countOfElements() + " " + // System.out.println(database.countOfElements() + " " +
// database.countOfArchivedElements() + " " + // database.countOfArchivedElements() + " " +
@ -691,8 +692,8 @@ public class SQLSikevaDBTest
@BeforeClass @BeforeClass
public static void beforeClass() throws SikevaDBException public static void beforeClass() throws SikevaDBException
{ {
BasicConfigurator.configure(); Configurator.initialize(new DefaultConfiguration());
Logger.getRootLogger().setLevel(Level.ERROR); Configurator.setRootLevel(Level.DEBUG);
// Add ?profileSQL=true to generate huge logs. // Add ?profileSQL=true to generate huge logs.
@ -701,7 +702,7 @@ public class SQLSikevaDBTest
// "12345678"); // "12345678");
database = new SQLSikevaDB("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:sikevadb-unittest;sql.syntax_mys=true", "sa", ""); database = new SQLSikevaDB("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:sikevadb-unittest;sql.syntax_mys=true", "sa", "");
database.open();
database.create(); database.create();
database.open();
} }
} }