Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
40e49a3bbb | |||
a17ca91389 | |||
b17515229a | |||
0303fee50b | |||
d40ee6acb4 | |||
eaacc3a3d6 | |||
4f1a466007 | |||
ca91a15396 | |||
e534a541d1 | |||
ecba48a615 | |||
71c9bb563a |
81 changed files with 1124 additions and 2839 deletions
35
.classpath
35
.classpath
|
@ -2,26 +2,29 @@
|
||||||
<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/hamcrest-core-1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/junit-4.11.jar" sourcepath="lib/junit-4.11-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/slf4j-log4j12-1.7.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/commons-codec-1.8.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||||
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
|
<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/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
|
<attributes>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
<attribute name="owner.project.facets" value="jst.utility"/>
|
||||||
|
</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/commons-io-2.16.1.jar" sourcepath="lib/commons-io-2.16.1-sources.jar"/>
|
<classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.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/joda-time-2.3.jar" sourcepath="lib/joda-time-2.3-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/hsqldb-2.3.0.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/commons-io-2.4-sources.jar"/>
|
||||||
<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/commons-io-2.4.jar" sourcepath="lib/commons-io-2.4-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/mariadb-java-client-3.4.1.jar"/>
|
<classpathentry kind="lib" path="lib/devinsy-utils-0.3.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/hsqldb-2.7.3.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib/Logs/log4j-api-2.23.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib/Logs/log4j-core-2.23.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib/Logs/log4j-slf4j2-impl-2.23.1.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>
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
encoding/<project>=UTF-8
|
|
|
@ -1,20 +1,15 @@
|
||||||
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=17
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=17
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
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.problem.reportPreviewFeatures=warning
|
org.eclipse.jdt.core.compiler.source=1.6
|
||||||
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
|
||||||
|
@ -22,30 +17,22 @@ 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_bitwise_operator=16
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=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
|
||||||
|
@ -66,13 +53,11 @@ 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
|
||||||
|
@ -105,7 +90,6 @@ 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
|
||||||
|
@ -114,7 +98,6 @@ 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
|
||||||
|
@ -128,12 +111,11 @@ 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_bitwise_operator=insert
|
org.eclipse.jdt.core.formatter.insert_space_after_binary_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
|
||||||
|
@ -163,9 +145,6 @@ 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
|
||||||
|
@ -190,17 +169,13 @@ 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_bitwise_operator=insert
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_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
|
||||||
|
@ -247,9 +222,6 @@ 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
|
||||||
|
@ -286,12 +258,9 @@ 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
|
||||||
|
@ -312,27 +281,11 @@ 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_additive_operator=true
|
org.eclipse.jdt.core.formatter.wrap_before_binary_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
|
||||||
|
|
|
@ -11,12 +11,10 @@ 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
|
||||||
|
@ -31,7 +29,6 @@ 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
|
||||||
|
@ -45,10 +42,8 @@ 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
|
||||||
|
@ -59,9 +54,7 @@ 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=13
|
formatter_settings_version=12
|
||||||
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
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<?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>
|
||||||
|
|
38
README.md
38
README.md
|
@ -1,38 +0,0 @@
|
||||||
# Welcome
|
|
||||||
|
|
||||||
SikevaDB is a Simple KEy VAlue DataBase.
|
|
||||||
|
|
||||||
Features:
|
|
||||||
* double key value
|
|
||||||
* single session only
|
|
||||||
* connector to file persistence
|
|
||||||
* connector to SQL persistence
|
|
||||||
|
|
||||||
Why build a single session database? Because, in so many cases, I need a single session only in my application.
|
|
||||||
|
|
||||||
Actually, the following backends are supported:
|
|
||||||
* file system
|
|
||||||
* MySQL Database
|
|
||||||
* HSQL Database
|
|
||||||
|
|
||||||
# LICENSE
|
|
||||||
|
|
||||||
SikevaDB is released under the GNU AGPL license. Enjoy!
|
|
||||||
|
|
||||||
# AUTHOR
|
|
||||||
|
|
||||||
Christian Pierre MOMON <christian.momon@devinsy.fr>
|
|
||||||
|
|
||||||
# Developer install
|
|
||||||
|
|
||||||
TODO
|
|
||||||
|
|
||||||
## Unit test environment
|
|
||||||
For unit tests, install the TestNG:
|
|
||||||
* https://marketplace.eclipse.org/content/testng-eclipse
|
|
||||||
* Eclipse menu > Help > Eclipse Marketplace > Find "TestNG" > TestNG for Eclipse: Install button
|
|
||||||
|
|
||||||
# LOGO
|
|
||||||
Author: Christian Pierre MOMON <christian.momon@devinsy.fr>
|
|
||||||
License: Creative Commons BY-ND-SA
|
|
||||||
Made with: Image from LibreOffice
|
|
|
@ -1,3 +1,3 @@
|
||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Fri Aug 23 12:19:51 CEST 2024
|
#Sat Feb 08 16:31:19 CET 2014
|
||||||
build.number=1
|
build.number=0
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
product.name=sikevadb
|
product.name=sikevadb
|
||||||
product.revision.major=1
|
product.revision.major=1
|
||||||
product.revision.minor=17
|
product.revision.minor=0
|
||||||
|
|
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.
27
lib/README
27
lib/README
|
@ -1,20 +1,9 @@
|
||||||
Description of used libraries:
|
Description of used libraries:
|
||||||
|
- commons-codec: digest tools
|
||||||
- Logs/
|
- commons-lang: useful tools (StringUtils...)
|
||||||
- log4j log API
|
- hamcrest-core: required by junit
|
||||||
- slf4j-api facade log API
|
- hsqldb: SQL Database for unit test.
|
||||||
- slf4j-log4j12 adaptation layer between slf4j and log4j
|
- junit: unit tests API
|
||||||
|
- log4j: log API
|
||||||
- UnitTesting/
|
- slf4j-api: facade log API
|
||||||
- hamcrest-core required by junit
|
- slf4j-log4j12: adaptation layer between slf4j and log4j
|
||||||
- hsqldb SQL Database for unit test.
|
|
||||||
- junit unit tests API
|
|
||||||
|
|
||||||
- other:
|
|
||||||
- commons-codec digest tools
|
|
||||||
- commons-io
|
|
||||||
- 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.
BIN
lib/commons-codec-1.8-sources.jar
Normal file
BIN
lib/commons-codec-1.8-sources.jar
Normal file
Binary file not shown.
BIN
lib/commons-codec-1.8.jar
Normal file
BIN
lib/commons-codec-1.8.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/commons-io-2.4-sources.jar
Normal file
BIN
lib/commons-io-2.4-sources.jar
Normal file
Binary file not shown.
BIN
lib/commons-io-2.4.jar
Normal file
BIN
lib/commons-io-2.4.jar
Normal file
Binary file not shown.
BIN
lib/commons-lang3-3.1-sources.jar
Normal file
BIN
lib/commons-lang3-3.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/commons-lang3-3.1.jar
Normal file
BIN
lib/commons-lang3-3.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.
BIN
lib/devinsy-utils-0.3.3-sources.zip
Normal file
BIN
lib/devinsy-utils-0.3.3-sources.zip
Normal file
Binary file not shown.
BIN
lib/devinsy-utils-0.3.3.jar
Normal file
BIN
lib/devinsy-utils-0.3.3.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/hsqldb-2.3.0.jar
Normal file
BIN
lib/hsqldb-2.3.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/joda-time-2.3-sources.jar
Normal file
BIN
lib/joda-time-2.3-sources.jar
Normal file
Binary file not shown.
BIN
lib/joda-time-2.3.jar
Normal file
BIN
lib/joda-time-2.3.jar
Normal file
Binary file not shown.
BIN
lib/junit-4.11-sources.jar
Normal file
BIN
lib/junit-4.11-sources.jar
Normal file
Binary file not shown.
BIN
lib/junit-4.11.jar
Normal file
BIN
lib/junit-4.11.jar
Normal file
Binary file not shown.
BIN
lib/log4j-1.2.17-source.zip
Normal file
BIN
lib/log4j-1.2.17-source.zip
Normal file
Binary file not shown.
BIN
lib/log4j-1.2.17.jar
Normal file
BIN
lib/log4j-1.2.17.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/mysql-jdbc-5.0.8.jar
Normal file
BIN
lib/mysql-jdbc-5.0.8.jar
Normal file
Binary file not shown.
BIN
lib/slf4j-api-1.7.5-sources.jar
Normal file
BIN
lib/slf4j-api-1.7.5-sources.jar
Normal file
Binary file not shown.
BIN
lib/slf4j-api-1.7.5.jar
Normal file
BIN
lib/slf4j-api-1.7.5.jar
Normal file
Binary file not shown.
BIN
lib/slf4j-log4j12-1.7.5-sources.jar
Normal file
BIN
lib/slf4j-log4j12-1.7.5-sources.jar
Normal file
Binary file not shown.
BIN
lib/slf4j-log4j12-1.7.5.jar
Normal file
BIN
lib/slf4j-log4j12-1.7.5.jar
Normal file
Binary file not shown.
|
@ -1,12 +0,0 @@
|
||||||
# Log configuration
|
|
||||||
# #################
|
|
||||||
|
|
||||||
# priority setting: DEBUG < INFO < WARN < ERROR
|
|
||||||
log4j.rootLogger = DEBUG, console
|
|
||||||
|
|
||||||
log4j.logger.fr.devinsy.util.xml = INFO
|
|
||||||
|
|
||||||
#--
|
|
||||||
log4j.appender.console = org.apache.log4j.ConsoleAppender
|
|
||||||
log4j.appender.console.layout = org.apache.log4j.PatternLayout
|
|
||||||
log4j.appender.console.layout.ConversionPattern = %d{ISO8601} - SikevaDB [%-5p] %34.34c.%25M - %m%n
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,34 +20,32 @@ package fr.devinsy.sikevadb;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.cli.SikevaDBCLI;
|
import fr.devinsy.sikevadb.cli.SikevaCLI;
|
||||||
import fr.devinsy.sikevadb.demo.SikevaDBDemo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SikevaDBLauncher.
|
* This class Siba stands for Simple Backup. This is the main class.
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public final class SikevaDBLauncher
|
public final class SikevaDBLauncher
|
||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger(SikevaDBLauncher.class);
|
private static Logger logger = LoggerFactory.getLogger(SikevaDBLauncher.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDB launcher.
|
*
|
||||||
*/
|
*/
|
||||||
private SikevaDBLauncher()
|
private SikevaDBLauncher()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main method.
|
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
* the arguments
|
|
||||||
*/
|
*/
|
||||||
public static void main(final String[] args)
|
public static void main(final String[] args)
|
||||||
{
|
{
|
||||||
|
@ -55,13 +53,13 @@ public final class SikevaDBLauncher
|
||||||
File loggerConfig = new File("log4j.properties");
|
File loggerConfig = new File("log4j.properties");
|
||||||
if (loggerConfig.exists())
|
if (loggerConfig.exists())
|
||||||
{
|
{
|
||||||
Configurator.initialize(null, loggerConfig.getAbsolutePath());
|
PropertyConfigurator.configure(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
|
||||||
{
|
{
|
||||||
Configurator.initialize(new DefaultConfiguration());
|
BasicConfigurator.configure();
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
@ -72,13 +70,9 @@ public final class SikevaDBLauncher
|
||||||
// TODO
|
// TODO
|
||||||
// SikevaGUI.run();
|
// SikevaGUI.run();
|
||||||
}
|
}
|
||||||
else if (ArrayUtils.contains(args, "-demo"))
|
|
||||||
{
|
|
||||||
SikevaDBDemo.run(args);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SikevaDBCLI.run(args);
|
SikevaCLI.run(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,28 +22,28 @@ 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.logging.log4j.core.config.Configurator;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
import fr.devinsy.strings.StringList;
|
|
||||||
import utils.BuildInformation;
|
import utils.BuildInformation;
|
||||||
|
import fr.devinsy.sikevadb.core.SikevaDBException;
|
||||||
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class <code>SikevaDBCLI</code> manages a Command Line Interface for
|
* This class manage a Command Line Interface for SikevaDB.
|
||||||
* SikevaDB.
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class SikevaDBCLI
|
public final class SikevaCLI
|
||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger(SikevaDBCLI.class);
|
private static Logger logger = LoggerFactory.getLogger(SikevaCLI.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDBCLI.
|
*
|
||||||
*/
|
*/
|
||||||
private SikevaDBCLI()
|
private SikevaCLI()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +65,8 @@ public final class SikevaDBCLI
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main method.
|
|
||||||
*
|
*
|
||||||
* @param args
|
* @param args
|
||||||
* the arguments
|
|
||||||
*/
|
*/
|
||||||
public static void main(final String[] args)
|
public static void main(final String[] args)
|
||||||
{
|
{
|
||||||
|
@ -76,19 +74,19 @@ public final class SikevaDBCLI
|
||||||
File loggerConfig = new File("log4j.properties");
|
File loggerConfig = new File("log4j.properties");
|
||||||
if (loggerConfig.exists())
|
if (loggerConfig.exists())
|
||||||
{
|
{
|
||||||
Configurator.initialize(null, loggerConfig.getAbsolutePath());
|
PropertyConfigurator.configure(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
|
||||||
{
|
{
|
||||||
Configurator.initialize(new DefaultConfiguration());
|
BasicConfigurator.configure();
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run.
|
// Run.
|
||||||
SikevaDBCLI.run(args);
|
SikevaCLI.run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +158,7 @@ public final class SikevaDBCLI
|
||||||
}
|
}
|
||||||
catch (SikevaDBException exception)
|
catch (SikevaDBException exception)
|
||||||
{
|
{
|
||||||
System.err.println("SikevaDBException = " + exception.getMessage());
|
System.err.println("SibaException = " + exception.getMessage());
|
||||||
logger.error(exception.getMessage(), exception);
|
logger.error(exception.getMessage(), exception);
|
||||||
help();
|
help();
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,54 +18,45 @@
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.sikevadb.cli;
|
package fr.devinsy.sikevadb.cli;
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SikevaDBCLIException.
|
*
|
||||||
*/
|
*/
|
||||||
public class SikevaDBCLIException extends SikevaDBException
|
public class SikevaCLIException extends Exception
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 2986878456227891377L;
|
private static final long serialVersionUID = 2986878456227891377L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDBCLI exception.
|
*
|
||||||
*/
|
*/
|
||||||
public SikevaDBCLIException()
|
public SikevaCLIException()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDBCLI exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBCLIException(final String message)
|
public SikevaCLIException(final String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDBCLI exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBCLIException(final String message, final Throwable cause)
|
public SikevaCLIException(final String message, final Throwable cause)
|
||||||
{
|
{
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDBCLI exception.
|
|
||||||
*
|
*
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBCLIException(final Throwable cause)
|
public SikevaCLIException(final Throwable cause)
|
||||||
{
|
{
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,61 +18,72 @@
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.sikevadb.core;
|
package fr.devinsy.sikevadb.core;
|
||||||
|
|
||||||
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface Archiver.
|
*
|
||||||
|
*
|
||||||
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
public interface Archiver
|
public interface Archiver
|
||||||
{
|
{
|
||||||
public enum Status
|
public void clear() throws SikevaDBException;
|
||||||
{
|
|
||||||
ACTIVATED,
|
|
||||||
SUSPENDED
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public void close() throws SikevaDBException;
|
||||||
* Activate.
|
|
||||||
*/
|
|
||||||
void activate();
|
|
||||||
|
|
||||||
/**
|
public long countOfElements() throws SikevaDBException;
|
||||||
* Archive.
|
|
||||||
*
|
|
||||||
* @param element
|
|
||||||
* the element
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
|
||||||
void archive(Element element) throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
public long countOfElements(String key) throws SikevaDBException;
|
||||||
* Clear.
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
|
||||||
void clear() throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
public long countOfElements(String key, String subkey) throws SikevaDBException;
|
||||||
* Close.
|
|
||||||
*/
|
|
||||||
void close();
|
|
||||||
|
|
||||||
/**
|
public Element getElement(String key) throws SikevaDBException;
|
||||||
* Checks if is activated.
|
|
||||||
*
|
|
||||||
* @return true, if is activated
|
|
||||||
*/
|
|
||||||
boolean isActivated();
|
|
||||||
|
|
||||||
/**
|
public Element getElement(String key, String subkey) throws SikevaDBException;
|
||||||
* Checks if is suspended.
|
|
||||||
*
|
|
||||||
* @return true, if is suspended
|
|
||||||
*/
|
|
||||||
boolean isSuspended();
|
|
||||||
|
|
||||||
/**
|
public Elements getElements() throws SikevaDBException;
|
||||||
* Suspend.
|
|
||||||
*/
|
public Elements getElements(String key) throws SikevaDBException;
|
||||||
void suspend();
|
|
||||||
|
public StringList getKeys() throws SikevaDBException;
|
||||||
|
|
||||||
|
public StringList getSubkeys(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
public String getValue(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
public String getValue(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
public StringList getValues(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
public boolean isClosed();
|
||||||
|
|
||||||
|
public boolean isOpened();
|
||||||
|
|
||||||
|
public long memorySize() throws SikevaDBException;
|
||||||
|
|
||||||
|
public long memorySize(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
public long memorySize(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
void open() throws SikevaDBException;
|
||||||
|
|
||||||
|
void put(Element element) throws SikevaDBException;
|
||||||
|
|
||||||
|
void put(String key, String value) throws SikevaDBException;
|
||||||
|
|
||||||
|
void put(String key, String subkey, String value) throws SikevaDBException;
|
||||||
|
|
||||||
|
void remove(final String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
void remove(final String key, final String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
|
void removeMany(final String key, final String... subkeys) throws SikevaDBException;
|
||||||
|
|
||||||
|
void renameKey(final String oldKey, final String newKey) throws SikevaDBException;
|
||||||
|
|
||||||
|
void renameSubKey(final String key, final String oldSubKey, final String newSubKey) throws SikevaDBException;
|
||||||
|
|
||||||
|
void replaceInValue(final String key, final String... tokens) throws SikevaDBException;
|
||||||
|
|
||||||
|
void replaceInValues(final String key, final String... tokens) throws SikevaDBException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,12 +18,11 @@
|
||||||
*/
|
*/
|
||||||
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.
|
*
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
|
@ -32,10 +31,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 LocalDateTime creationDate;
|
private DateTime creationDate;
|
||||||
private LocalDateTime editionDate;
|
private DateTime editionDate;
|
||||||
/* archiveDate field is reserved for journalizer. */
|
/* archiveDate field is reserved for journalizer. */
|
||||||
private LocalDateTime archiveDate;
|
private DateTime archiveDate;
|
||||||
private String key;
|
private String key;
|
||||||
private String subkey;
|
private String subkey;
|
||||||
private long size;
|
private long size;
|
||||||
|
@ -43,7 +42,9 @@ public class Element
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new element.
|
*
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
*/
|
*/
|
||||||
public Element()
|
public Element()
|
||||||
{
|
{
|
||||||
|
@ -51,14 +52,9 @@ public class Element
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new element.
|
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
|
||||||
* @param subkey
|
|
||||||
* the subkey
|
|
||||||
* @param value
|
* @param value
|
||||||
* the value
|
|
||||||
*/
|
*/
|
||||||
public Element(final String key, final String subkey, final String value)
|
public Element(final String key, final String subkey, final String value)
|
||||||
{
|
{
|
||||||
|
@ -69,207 +65,106 @@ public class Element
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Archive.
|
*
|
||||||
*/
|
*/
|
||||||
public void archive()
|
public void archive()
|
||||||
{
|
{
|
||||||
this.archiveDate = LocalDateTime.now();
|
this.archiveDate = DateTime.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public DateTime getArchiveDate()
|
||||||
* Gets the archive date.
|
|
||||||
*
|
|
||||||
* @return the archive date
|
|
||||||
*/
|
|
||||||
public LocalDateTime getArchiveDate()
|
|
||||||
{
|
{
|
||||||
return this.archiveDate;
|
return this.archiveDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public DateTime getCreationDate()
|
||||||
* Gets the creation date.
|
|
||||||
*
|
|
||||||
* @return the creation date
|
|
||||||
*/
|
|
||||||
public LocalDateTime getCreationDate()
|
|
||||||
{
|
{
|
||||||
return this.creationDate;
|
return this.creationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the digest.
|
|
||||||
*
|
|
||||||
* @return the digest
|
|
||||||
*/
|
|
||||||
public String getDigest()
|
public String getDigest()
|
||||||
{
|
{
|
||||||
return this.digest;
|
return this.digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public DateTime getEditionDate()
|
||||||
* Gets the edition date.
|
|
||||||
*
|
|
||||||
* @return the edition date
|
|
||||||
*/
|
|
||||||
public LocalDateTime getEditionDate()
|
|
||||||
{
|
{
|
||||||
return this.editionDate;
|
return this.editionDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the id.
|
|
||||||
*
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
public long getId()
|
public long getId()
|
||||||
{
|
{
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the key.
|
|
||||||
*
|
|
||||||
* @return the key
|
|
||||||
*/
|
|
||||||
public String getKey()
|
public String getKey()
|
||||||
{
|
{
|
||||||
return this.key;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the size.
|
|
||||||
*
|
|
||||||
* @return the size
|
|
||||||
*/
|
|
||||||
public long getSize()
|
public long getSize()
|
||||||
{
|
{
|
||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the subkey.
|
|
||||||
*
|
|
||||||
* @return the subkey
|
|
||||||
*/
|
|
||||||
public String getSubkey()
|
public String getSubkey()
|
||||||
{
|
{
|
||||||
return this.subkey;
|
return this.subkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value.
|
|
||||||
*
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
public String getValue()
|
public String getValue()
|
||||||
{
|
{
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setArchiveDate(final DateTime date)
|
||||||
* Sets the archive date.
|
|
||||||
*
|
|
||||||
* @param date
|
|
||||||
* the new archive date
|
|
||||||
*/
|
|
||||||
public void setArchiveDate(final LocalDateTime date)
|
|
||||||
{
|
{
|
||||||
this.archiveDate = date;
|
this.archiveDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setCreationDate(final DateTime date)
|
||||||
* Sets the creation date.
|
|
||||||
*
|
|
||||||
* @param date
|
|
||||||
* the new creation date
|
|
||||||
*/
|
|
||||||
public void setCreationDate(final LocalDateTime date)
|
|
||||||
{
|
{
|
||||||
this.creationDate = date;
|
this.creationDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the digest.
|
|
||||||
*
|
|
||||||
* @param digest
|
|
||||||
* the new digest
|
|
||||||
*/
|
|
||||||
public void setDigest(final String digest)
|
public void setDigest(final String digest)
|
||||||
{
|
{
|
||||||
this.digest = digest;
|
this.digest = digest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setEditionDate(final DateTime date)
|
||||||
* Sets the edition date.
|
|
||||||
*
|
|
||||||
* @param date
|
|
||||||
* the new edition date
|
|
||||||
*/
|
|
||||||
public void setEditionDate(final LocalDateTime date)
|
|
||||||
{
|
{
|
||||||
this.editionDate = date;
|
this.editionDate = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the id.
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* the new id
|
|
||||||
*/
|
|
||||||
public void setId(final long id)
|
public void setId(final long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the key.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the new key
|
|
||||||
*/
|
|
||||||
public void setKey(final String key)
|
public void setKey(final String key)
|
||||||
{
|
{
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the size.
|
|
||||||
*
|
|
||||||
* @param size
|
|
||||||
* the new size
|
|
||||||
*/
|
|
||||||
public void setSize(final long size)
|
public void setSize(final long size)
|
||||||
{
|
{
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the subkey.
|
|
||||||
*
|
|
||||||
* @param subkey
|
|
||||||
* the new subkey
|
|
||||||
*/
|
|
||||||
public void setSubkey(final String subkey)
|
public void setSubkey(final String subkey)
|
||||||
{
|
{
|
||||||
this.subkey = subkey;
|
this.subkey = subkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the value.
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* the new value
|
|
||||||
*/
|
|
||||||
public void setValue(final String value)
|
public void setValue(final String value)
|
||||||
{
|
{
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update.
|
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value
|
||||||
* the value
|
|
||||||
*/
|
*/
|
||||||
public void update(final String value)
|
public void update(final String value)
|
||||||
{
|
{
|
||||||
|
@ -277,7 +172,7 @@ public class Element
|
||||||
setValue(value);
|
setValue(value);
|
||||||
|
|
||||||
//
|
//
|
||||||
this.editionDate = LocalDateTime.now();
|
this.editionDate = DateTime.now();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,16 +21,16 @@ package fr.devinsy.sikevadb.core;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class Elements.
|
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
*
|
||||||
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
public class Elements extends ArrayList<Element>
|
public class Elements extends ArrayList<Element>
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 6298920093179395791L;
|
private static final long serialVersionUID = 6298920093179395791L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new elements.
|
*
|
||||||
*/
|
*/
|
||||||
public Elements()
|
public Elements()
|
||||||
{
|
{
|
||||||
|
@ -38,10 +38,7 @@ public class Elements extends ArrayList<Element>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new elements.
|
|
||||||
*
|
*
|
||||||
* @param initialCapacity
|
|
||||||
* the initial capacity
|
|
||||||
*/
|
*/
|
||||||
public Elements(final int initialCapacity)
|
public Elements(final int initialCapacity)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 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,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.sikevadb.core;
|
package fr.devinsy.sikevadb.core;
|
||||||
|
|
||||||
import fr.devinsy.strings.StringList;
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface SikevaDB.
|
* The Interface SikevaDB.
|
||||||
|
@ -27,15 +27,6 @@ import fr.devinsy.strings.StringList;
|
||||||
*/
|
*/
|
||||||
public interface SikevaDB
|
public interface SikevaDB
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Archiver.
|
|
||||||
*
|
|
||||||
* @return the archiver
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
|
||||||
public Archiver archiver() throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all elements of current opened database.
|
* Delete all elements of current opened database.
|
||||||
*
|
*
|
||||||
|
@ -73,20 +64,7 @@ public interface SikevaDB
|
||||||
public long countOfElements(String key) throws SikevaDBException;
|
public long countOfElements(String key) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count of elements by key and sub key.
|
* Count of elements by key and subkey.
|
||||||
*
|
|
||||||
* @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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Count of elements by key and sub key.
|
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
|
@ -107,7 +85,7 @@ public interface SikevaDB
|
||||||
public void create() throws SikevaDBException;
|
public void create() throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an database element with its key.
|
* Removes the.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
|
@ -117,31 +95,19 @@ public interface SikevaDB
|
||||||
void delete(final String key) throws SikevaDBException;
|
void delete(final String key) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an database element with its key and subkey.
|
* Delete.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param subkey
|
* @param subkey
|
||||||
* the sub key
|
* the subkey
|
||||||
* @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
|
* @throws SikevaDBException
|
||||||
* the SikevaDB exception
|
* the SikevaDB exception
|
||||||
*/
|
*/
|
||||||
void delete(final String key, final String subkey) throws SikevaDBException;
|
void delete(final String key, final String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete many database elements from key and sub keys.
|
* Delete many.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
|
@ -152,23 +118,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
void deleteMany(final String key, final String... subkeys) throws SikevaDBException;
|
void deleteMany(final String key, final String... subkeys) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy.
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
|
||||||
public void destroy() throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is created.
|
|
||||||
*
|
|
||||||
* @return true, if is created
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
|
||||||
public boolean exists() throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an element by key.
|
* Gets an element by key.
|
||||||
*
|
*
|
||||||
|
@ -180,19 +129,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an element by key and sub key.
|
* Gets an element by key and sub key.
|
||||||
*
|
*
|
||||||
|
@ -226,6 +162,15 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
public Elements getElements(String key) throws SikevaDBException;
|
public Elements getElements(String key) throws SikevaDBException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the top keys.
|
||||||
|
*
|
||||||
|
* @return the keys
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
public StringList getKeys() throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the sub keys of a key.
|
* Gets all the sub keys of a key.
|
||||||
*
|
*
|
||||||
|
@ -237,15 +182,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
public StringList getSubkeys(String key) throws SikevaDBException;
|
public StringList getSubkeys(String key) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets all the top keys.
|
|
||||||
*
|
|
||||||
* @return the keys
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
|
||||||
public StringList getTopKeys() throws SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of a key.
|
* Gets the value of a key.
|
||||||
*
|
*
|
||||||
|
@ -257,19 +193,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of a key and a sub key.
|
* Gets the value of a key and a sub key.
|
||||||
*
|
*
|
||||||
|
@ -284,30 +207,16 @@ public interface SikevaDB
|
||||||
public String getValue(String key, String subkey) throws SikevaDBException;
|
public String getValue(String key, String subkey) throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the values.
|
* Gets the values of a key.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @return the values
|
* @return the values
|
||||||
* @throws SikevaDBException
|
* @throws SikevaDBException
|
||||||
* the sikeva DB exception
|
* the SikevaDB 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();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is archive suspended.
|
|
||||||
*
|
|
||||||
* @return true, if is archive suspended
|
|
||||||
*/
|
|
||||||
boolean isArchiveSuspended();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is closed.
|
* Checks if is closed.
|
||||||
*
|
*
|
||||||
|
@ -315,6 +224,15 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
public boolean isClosed();
|
public boolean isClosed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is created.
|
||||||
|
*
|
||||||
|
* @return true, if is created
|
||||||
|
* @throws SikevaDBException
|
||||||
|
* the SikevaDB exception
|
||||||
|
*/
|
||||||
|
public boolean isCreated() throws SikevaDBException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is opened.
|
* Checks if is opened.
|
||||||
*
|
*
|
||||||
|
@ -342,19 +260,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the memory size of element of a key and a sub key.
|
* Returns the memory size of element of a key and a sub key.
|
||||||
*
|
*
|
||||||
|
@ -386,20 +291,6 @@ public interface SikevaDB
|
||||||
*/
|
*/
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put a value for a key in current opened database.
|
* Put a value for a key in current opened database.
|
||||||
*
|
*
|
||||||
|
@ -418,7 +309,7 @@ public interface SikevaDB
|
||||||
* @param key
|
* @param key
|
||||||
* the key
|
* the key
|
||||||
* @param subkey
|
* @param subkey
|
||||||
* the sub key
|
* the subkey
|
||||||
* @param value
|
* @param value
|
||||||
* the value
|
* the value
|
||||||
* @throws SikevaDBException
|
* @throws SikevaDBException
|
||||||
|
@ -450,21 +341,7 @@ public interface SikevaDB
|
||||||
* @throws SikevaDBException
|
* @throws SikevaDBException
|
||||||
* the SikevaDB exception
|
* the SikevaDB exception
|
||||||
*/
|
*/
|
||||||
void renameSubkey(final String key, final long oldSubKey, final long newSubKey) throws SikevaDBException;
|
void renameSubKey(final String key, final String oldSubKey, final String 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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace a substring in a value of a key.
|
* Replace a substring in a value of a key.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2016 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,7 +19,6 @@
|
||||||
package fr.devinsy.sikevadb.core;
|
package fr.devinsy.sikevadb.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SikevaDBException.
|
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +27,7 @@ public class SikevaDBException extends Exception
|
||||||
private static final long serialVersionUID = 8323299610751708972L;
|
private static final long serialVersionUID = 8323299610751708972L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDB exception.
|
*
|
||||||
*/
|
*/
|
||||||
public SikevaDBException()
|
public SikevaDBException()
|
||||||
{
|
{
|
||||||
|
@ -36,10 +35,8 @@ public class SikevaDBException extends Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDB exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBException(final String message)
|
public SikevaDBException(final String message)
|
||||||
{
|
{
|
||||||
|
@ -47,12 +44,9 @@ public class SikevaDBException extends Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDB exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBException(final String message, final Throwable cause)
|
public SikevaDBException(final String message, final Throwable cause)
|
||||||
{
|
{
|
||||||
|
@ -60,10 +54,8 @@ public class SikevaDBException extends Exception
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new SikevaDB exception.
|
|
||||||
*
|
*
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public SikevaDBException(final Throwable cause)
|
public SikevaDBException(final Throwable cause)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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.
|
||||||
|
@ -24,24 +24,18 @@ import fr.devinsy.sikevadb.filetree.FileTreeSikevaDB;
|
||||||
import fr.devinsy.sikevadb.sql.SQLSikevaDB;
|
import fr.devinsy.sikevadb.sql.SQLSikevaDB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A factory for creating SikevaDB objects.
|
*
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
public class SikevaDBFactory
|
public class SikevaDBFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets a SikevaDB instance from its database home directory.
|
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* the path of the database home directory
|
* @return
|
||||||
*
|
|
||||||
* @return a SikevaDB instance
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
public static SikevaDB get(final File path) throws SikevaDBException
|
public static SikevaDB get(final File path)
|
||||||
{
|
{
|
||||||
SikevaDB result;
|
SikevaDB result;
|
||||||
|
|
||||||
|
@ -52,15 +46,9 @@ public class SikevaDBFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a SikevaDB instance from a context.
|
|
||||||
*
|
*
|
||||||
* @param contextName
|
* @param contextName
|
||||||
* the context name
|
* @return
|
||||||
*
|
|
||||||
* @return a SikevaDB instance
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
public static SikevaDB get(final String contextName)
|
public static SikevaDB get(final String contextName)
|
||||||
{
|
{
|
||||||
|
@ -73,18 +61,12 @@ public class SikevaDBFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a SikevaDB instance from dabase parameters.
|
|
||||||
*
|
*
|
||||||
* @param driverClassName
|
* @param driverClassName
|
||||||
* the driver class name
|
|
||||||
* @param url
|
* @param url
|
||||||
* the url
|
|
||||||
* @param login
|
* @param login
|
||||||
* the login
|
|
||||||
* @param password
|
* @param password
|
||||||
* the password
|
* @return
|
||||||
*
|
|
||||||
* @return the SikevaDB
|
|
||||||
*/
|
*/
|
||||||
public static SikevaDB get(final String driverClassName, final String url, final String login, final String password)
|
public static SikevaDB get(final String driverClassName, final String url, final String login, final String password)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,17 +21,12 @@ package fr.devinsy.sikevadb.core;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SikevaDBUtils.
|
*
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
public class SikevaDBUtils
|
public class SikevaDBUtils
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Gets the current time in long format.
|
|
||||||
*
|
|
||||||
* @return the long
|
|
||||||
*/
|
|
||||||
public static long now()
|
public static long now()
|
||||||
{
|
{
|
||||||
return new Date().getTime();
|
return new Date().getTime();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2018-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 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.
|
||||||
*
|
*
|
||||||
|
@ -19,51 +19,45 @@
|
||||||
package fr.devinsy.sikevadb.core;
|
package fr.devinsy.sikevadb.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ClosedDatabaseException.
|
*
|
||||||
|
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||||
*/
|
*/
|
||||||
public class ClosedDatabaseException extends SikevaDBException
|
public class UnopenedDatabaseException extends SikevaDBException
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 8364599416669077052L;
|
private static final long serialVersionUID = 8364599416669077052L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new closed database exception.
|
*
|
||||||
*/
|
*/
|
||||||
public ClosedDatabaseException()
|
public UnopenedDatabaseException()
|
||||||
{
|
{
|
||||||
super("Invalid database status for this operation: closed.");
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new closed database exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
*/
|
*/
|
||||||
public ClosedDatabaseException(final String message)
|
public UnopenedDatabaseException(final String message)
|
||||||
{
|
{
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new closed database exception.
|
|
||||||
*
|
*
|
||||||
* @param message
|
* @param message
|
||||||
* the message
|
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public ClosedDatabaseException(final String message, final Throwable cause)
|
public UnopenedDatabaseException(final String message, final Throwable cause)
|
||||||
{
|
{
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new closed database exception.
|
|
||||||
*
|
*
|
||||||
* @param cause
|
* @param cause
|
||||||
* the cause
|
|
||||||
*/
|
*/
|
||||||
public ClosedDatabaseException(final Throwable cause)
|
public UnopenedDatabaseException(final Throwable cause)
|
||||||
{
|
{
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 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.
|
||||||
*
|
*
|
||||||
|
@ -19,82 +19,59 @@
|
||||||
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.xml.XMLBadFormatException;
|
import fr.devinsy.util.xml.XMLBadFormatException;
|
||||||
import fr.devinsy.xml.XMLReader;
|
import fr.devinsy.util.xml.XMLReader;
|
||||||
import fr.devinsy.xml.XMLTag;
|
import fr.devinsy.util.xml.XMLTag;
|
||||||
import fr.devinsy.xml.XMLTag.TagType;
|
import fr.devinsy.util.xml.XMLTag.TagType;
|
||||||
import fr.devinsy.xml.XMLWriter;
|
import fr.devinsy.util.xml.XMLWriter;
|
||||||
import fr.devinsy.xml.XMLZipWriter;
|
import fr.devinsy.util.xml.XMLZipWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class XMLSikevaDB represents a XML persister.
|
* This class represents a AccountManager File reader and writer.
|
||||||
|
*
|
||||||
|
* @author TIP
|
||||||
*/
|
*/
|
||||||
public class XMLSikevaDB
|
public class XMLSikevaDB
|
||||||
{
|
{
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class);
|
private static final Logger logger = LoggerFactory.getLogger(XMLSikevaDB.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export.
|
* Saves a net in a file.
|
||||||
*
|
*
|
||||||
* @param out
|
* @param file
|
||||||
* the out
|
* Target.
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* Source.
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
* @throws FileNotFoundException
|
|
||||||
* the file not found 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
|
public static void export(final OutputStream out, final SikevaDB source) throws Exception
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
String fileName = "sikevadb-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH'h'mm'mn'ss's'")) + ".xml.zip";
|
String fileName = "sikevadb-" + DateTime.now().toString("yyyy-MM-dd-HH'h'mm'mn'ss's'") + ".xml.zip";
|
||||||
|
|
||||||
//
|
//
|
||||||
export(out, source, fileName);
|
export(out, source, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export.
|
* Saves a net in a file.
|
||||||
*
|
*
|
||||||
* @param out
|
* @param file
|
||||||
* the out
|
* Target.
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* Source.
|
||||||
* @param fileName
|
*
|
||||||
* the file name
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws SikevaDBException
|
public static void export(final OutputStream out, final SikevaDB source, final String fileName) throws Exception
|
||||||
{
|
{
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
|
@ -122,39 +99,23 @@ 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)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
target.close();
|
target.close();
|
||||||
}
|
}
|
||||||
catch (IOException exception)
|
|
||||||
{
|
|
||||||
logger.warn("Problem closing stream.", exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Import data.
|
|
||||||
*
|
*
|
||||||
* @param database
|
|
||||||
* the database
|
|
||||||
* @param file
|
* @param file
|
||||||
* the file
|
* @return
|
||||||
*/
|
*/
|
||||||
public static void importData(final SikevaDB database, final File file)
|
public static void importData(final SikevaDB database, final File file) throws Exception
|
||||||
{
|
{
|
||||||
// TODO
|
|
||||||
|
|
||||||
// XMLReader in = null;
|
// XMLReader in = null;
|
||||||
// try {
|
// try {
|
||||||
// in = new XMLZipReader(file);
|
// in = new XMLZipReader(file);
|
||||||
|
@ -167,20 +128,17 @@ public class XMLSikevaDB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read element.
|
|
||||||
*
|
*
|
||||||
|
* @param target
|
||||||
* @param in
|
* @param in
|
||||||
* the in
|
* @throws XMLBadFormatException
|
||||||
* @return the element
|
* @throws XMLStreamException
|
||||||
* @throws SikevaDBException
|
* @throws Exception
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
*/
|
||||||
public static Element readElement(final XMLReader in) throws SikevaDBException
|
public static Element readElement(final XMLReader in) throws XMLStreamException, XMLBadFormatException
|
||||||
{
|
{
|
||||||
Element result;
|
Element result;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
XMLTag tag = in.readStartTag("element");
|
XMLTag tag = in.readStartTag("element");
|
||||||
|
|
||||||
|
@ -193,10 +151,10 @@ public class XMLSikevaDB
|
||||||
String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent());
|
String value = StringEscapeUtils.unescapeXml(in.readContentTag("value").getContent());
|
||||||
int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue());
|
int size = Integer.parseInt(tag.attributes().getByLabel("size").getValue());
|
||||||
String digest = in.readContentTag("digest").getContent();
|
String digest = in.readContentTag("digest").getContent();
|
||||||
LocalDateTime creationDate = LocalDateTime.parse(in.readContentTag("creation_date").getContent());
|
DateTime creationDate = DateTime.parse(in.readContentTag("creation_date").getContent());
|
||||||
LocalDateTime editionDate = LocalDateTime.parse(in.readContentTag("edition_date").getContent());
|
DateTime editionDate = DateTime.parse(in.readContentTag("edition_date").getContent());
|
||||||
|
|
||||||
LocalDateTime archiveDate;
|
DateTime archiveDate;
|
||||||
String archiveDateValue = in.readNullableContentTag("archive_date").getContent();
|
String archiveDateValue = in.readNullableContentTag("archive_date").getContent();
|
||||||
if (archiveDateValue == null)
|
if (archiveDateValue == null)
|
||||||
{
|
{
|
||||||
|
@ -204,7 +162,7 @@ public class XMLSikevaDB
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
archiveDate = LocalDateTime.parse(archiveDateValue);
|
archiveDate = DateTime.parse(archiveDateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -223,43 +181,31 @@ public class XMLSikevaDB
|
||||||
|
|
||||||
//
|
//
|
||||||
in.readEndTag("element");
|
in.readEndTag("element");
|
||||||
}
|
|
||||||
catch (XMLStreamException exception)
|
|
||||||
{
|
|
||||||
throw new SikevaDBException("Problem reading element.", exception);
|
|
||||||
}
|
|
||||||
catch (XMLBadFormatException exception)
|
|
||||||
{
|
|
||||||
throw new SikevaDBException("Problem reading element.", exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read elements.
|
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* the target
|
|
||||||
* @param in
|
* @param in
|
||||||
* the in
|
* @throws Exception
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
*/
|
||||||
public static void readElements(final SikevaDB target, final XMLReader in) throws SikevaDBException
|
public static void readElements(final SikevaDB target, final XMLReader in) throws Exception
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
|
//
|
||||||
XMLTag list = in.readListTag("elements");
|
XMLTag list = in.readListTag("elements");
|
||||||
|
|
||||||
//
|
//
|
||||||
if (list.getType() != TagType.EMPTY)
|
if (list.getType() != TagType.EMPTY)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
while (in.hasNextStartTag("element"))
|
while (in.hasNextStartTag("element"))
|
||||||
{
|
{
|
||||||
|
//
|
||||||
Element element = readElement(in);
|
Element element = readElement(in);
|
||||||
|
|
||||||
|
//
|
||||||
target.put(element);
|
target.put(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,34 +213,22 @@ public class XMLSikevaDB
|
||||||
in.readEndTag("elements");
|
in.readEndTag("elements");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (XMLStreamException exception)
|
|
||||||
{
|
|
||||||
throw new SikevaDBException("Problem reading element.", exception);
|
|
||||||
}
|
|
||||||
catch (XMLBadFormatException exception)
|
|
||||||
{
|
|
||||||
throw new SikevaDBException("Problem reading element.", exception);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write.
|
|
||||||
*
|
*
|
||||||
* @param out
|
|
||||||
* the out
|
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @return
|
||||||
*/
|
*/
|
||||||
public static void write(final XMLWriter out, final Element source)
|
public static void write(final XMLWriter out, final Element source)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("Parameter out is null.");
|
throw new IllegalArgumentException("out is null.");
|
||||||
}
|
}
|
||||||
else if (source == null)
|
else if (source == null)
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("Parameter element is null.");
|
throw new IllegalArgumentException("element is null.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -334,17 +268,12 @@ public class XMLSikevaDB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write in an XML writer the elements of a database, sorting by keys and
|
|
||||||
* sub keys.
|
|
||||||
*
|
*
|
||||||
* @param out
|
* @param out
|
||||||
* the out
|
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @throws Exception
|
||||||
* @throws SikevaDBException
|
|
||||||
* the sikeva DB exception
|
|
||||||
*/
|
*/
|
||||||
public static void write(final XMLWriter out, final SikevaDB source) throws SikevaDBException
|
public static void write(final XMLWriter out, final SikevaDB source) throws Exception
|
||||||
{
|
{
|
||||||
if (out == null)
|
if (out == null)
|
||||||
{
|
{
|
||||||
|
@ -358,20 +287,17 @@ public class XMLSikevaDB
|
||||||
{
|
{
|
||||||
out.writeStartTag("elements");
|
out.writeStartTag("elements");
|
||||||
|
|
||||||
for (String topkey : source.getTopKeys().sort())
|
for (String key : source.getKeys())
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Element topElement = source.getElement(topkey);
|
Element root = source.getElement(key);
|
||||||
if (topElement != null)
|
write(out, root);
|
||||||
{
|
|
||||||
write(out, topElement);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
for (String subkey : source.getSubkeys(topkey).sort())
|
Elements elements = source.getElements(key);
|
||||||
|
for (Element element : elements)
|
||||||
{
|
{
|
||||||
Element subElement = source.getElement(topkey, subkey);
|
write(out, element);
|
||||||
write(out, subElement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,263 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2013-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.demo;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
|
||||||
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDB;
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBFactory;
|
|
||||||
import fr.devinsy.strings.StringList;
|
|
||||||
import utils.BuildInformation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class SikevaDBDemo is a demo for SikevaDB.
|
|
||||||
*/
|
|
||||||
public final class SikevaDBDemo
|
|
||||||
{
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(SikevaDBDemo.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SikevaDBDemo class has to be not instanciated.
|
|
||||||
*/
|
|
||||||
private SikevaDBDemo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Demo.
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
|
||||||
public static void demo() throws SikevaDBException
|
|
||||||
{
|
|
||||||
SikevaDB database = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//
|
|
||||||
File homeDirectory = new File("/tmp/footest");
|
|
||||||
database = SikevaDBFactory.get(homeDirectory);
|
|
||||||
|
|
||||||
if (database.exists())
|
|
||||||
{
|
|
||||||
database.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
database.create();
|
|
||||||
database.open();
|
|
||||||
|
|
||||||
// Single key value.
|
|
||||||
{
|
|
||||||
database.put("alpha", "alpha value");
|
|
||||||
database.put("bravo", "bravo value");
|
|
||||||
database.put("charlie", "charlie value");
|
|
||||||
|
|
||||||
String value = database.getValue("alpha");
|
|
||||||
if (StringUtils.equals(value, "alpha value"))
|
|
||||||
{
|
|
||||||
System.out.println("alpha is correctly stored.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("alpha is NOT correctly stored.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
database.delete("alpha");
|
|
||||||
if (database.getValue("alpha") == null)
|
|
||||||
{
|
|
||||||
System.out.println("alpha is correctly deleted.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("alpha is NOT correctly deleted.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Double key values.
|
|
||||||
{
|
|
||||||
for (int index = 0; index < 10; index++)
|
|
||||||
{
|
|
||||||
database.put("victor", index, "victor" + index);
|
|
||||||
}
|
|
||||||
|
|
||||||
String value = database.getValue("victor", 7);
|
|
||||||
if (StringUtils.equals(value, "victor7"))
|
|
||||||
{
|
|
||||||
System.out.println("victor is correctly stored.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("victor is NOT correctly stored.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
database.delete("victor", 5);
|
|
||||||
if (database.getValue("victor", 5) == null)
|
|
||||||
{
|
|
||||||
System.out.println("(victor, 5) is correctly deleted.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("(victor, 5) is NOT correctly deleted.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
System.out.println(String.format("Database values:\t %d elements", database.countOfElements()));
|
|
||||||
System.out.println(String.format("Database memory:\t %d bytes", database.memorySize()));
|
|
||||||
|
|
||||||
//
|
|
||||||
database.close();
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if ((database != null) && (database.exists()))
|
|
||||||
{
|
|
||||||
database.destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method displays the CLI help.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void help()
|
|
||||||
{
|
|
||||||
StringList message = new StringList();
|
|
||||||
|
|
||||||
message.append("SikevaDB Demo version ").appendln(BuildInformation.instance().version());
|
|
||||||
message.appendln("Usage:");
|
|
||||||
message.appendln(" sikevadbdemo [ -h | -help | --help ]");
|
|
||||||
message.appendln(" sikevadb -demo [ -h | -help | --help ]");
|
|
||||||
|
|
||||||
System.out.println(message.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The main method.
|
|
||||||
*
|
|
||||||
* @param args
|
|
||||||
* the arguments
|
|
||||||
*/
|
|
||||||
public static void main(final String[] args)
|
|
||||||
{
|
|
||||||
// Configure log.
|
|
||||||
File loggerConfig = new File("log4j.properties");
|
|
||||||
if (loggerConfig.exists())
|
|
||||||
{
|
|
||||||
Configurator.initialize(null, loggerConfig.getAbsolutePath());
|
|
||||||
logger.info("Dedicated log configuration done.");
|
|
||||||
logger.info("Configuration file was found in [{}].", loggerConfig.getAbsoluteFile());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Configurator.initialize(new DefaultConfiguration());
|
|
||||||
logger.info("Basic log configuration done.");
|
|
||||||
logger.info("Configuration file was not found in [{}].", loggerConfig.getAbsoluteFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run.
|
|
||||||
SikevaDBDemo.run(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* This method launch CLI.
|
|
||||||
*
|
|
||||||
* @param args
|
|
||||||
* necessary arguments
|
|
||||||
*/
|
|
||||||
public static void run(final String[] args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Set default catch.
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void uncaughtException(final Thread thread, final Throwable exception)
|
|
||||||
{
|
|
||||||
String message;
|
|
||||||
if (exception instanceof OutOfMemoryError)
|
|
||||||
{
|
|
||||||
message = "Java ran out of memory!\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message = String.format("An error occured: %1s(%2s)", exception.getClass(), exception.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.error("uncaughtException ", exception);
|
|
||||||
logger.error(message);
|
|
||||||
logger.info("Oups, an unexpected error occured. Please try again.");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// This part implements an automate.
|
|
||||||
int parameterCount = args.length;
|
|
||||||
if (parameterCount == 0)
|
|
||||||
{
|
|
||||||
demo();
|
|
||||||
}
|
|
||||||
else if (StringUtils.equals(args[0], "-h") || StringUtils.equals(args[0], "-help") || StringUtils.equals(args[0], "--help"))
|
|
||||||
{
|
|
||||||
help();
|
|
||||||
}
|
|
||||||
else if (StringUtils.equals(args[0], "get"))
|
|
||||||
{
|
|
||||||
switch (parameterCount)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new SikevaDBException("Bad parameter count.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
System.out.println("Bad usage detected.");
|
|
||||||
help();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (SikevaDBException exception)
|
|
||||||
{
|
|
||||||
System.err.println("SibaException = " + exception.getMessage());
|
|
||||||
logger.error(exception.getMessage(), exception);
|
|
||||||
help();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 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.demo;
|
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class SikevaDBDemoException.
|
|
||||||
*/
|
|
||||||
public class SikevaDBDemoException extends SikevaDBException
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1162267847144476595L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new SikevaDB demo exception.
|
|
||||||
*/
|
|
||||||
public SikevaDBDemoException()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new SikevaDB demo exception.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* the message
|
|
||||||
*/
|
|
||||||
public SikevaDBDemoException(final String message)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new SikevaDB demo exception.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* the message
|
|
||||||
* @param cause
|
|
||||||
* the cause
|
|
||||||
*/
|
|
||||||
public SikevaDBDemoException(final String message, final Throwable cause)
|
|
||||||
{
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new SikevaDB demo exception.
|
|
||||||
*
|
|
||||||
* @param cause
|
|
||||||
* the cause
|
|
||||||
*/
|
|
||||||
public SikevaDBDemoException(final Throwable cause)
|
|
||||||
{
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
}
|
|
48
src/fr/devinsy/sikevadb/filetree/ArchiveManager.java
Normal file
48
src/fr/devinsy/sikevadb/filetree/ArchiveManager.java
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2013-2016 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.filetree;
|
||||||
|
|
||||||
|
import fr.devinsy.sikevadb.core.SikevaDB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Christian Pierre MOMON
|
||||||
|
*/
|
||||||
|
public class ArchiveManager
|
||||||
|
{
|
||||||
|
private SikevaDB database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param source
|
||||||
|
*/
|
||||||
|
public ArchiveManager(final SikevaDB source)
|
||||||
|
{
|
||||||
|
if (this.database == null)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("Null parameter.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.database = source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,165 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 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.filetree;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.Archiver;
|
|
||||||
import fr.devinsy.sikevadb.core.Element;
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDB;
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class FileTreeArchiver.
|
|
||||||
*
|
|
||||||
* @author Christian Pierre MOMON
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class FileTreeArchiver implements Archiver
|
|
||||||
{
|
|
||||||
private static final String ARCHIVE_PATH = "archive";
|
|
||||||
|
|
||||||
private Status status;
|
|
||||||
private File archiveDirectory;
|
|
||||||
private SikevaDB database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new file tree archiver.
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* the source
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
|
||||||
public FileTreeArchiver(final FileTreeSikevaDB source) throws SikevaDBException
|
|
||||||
{
|
|
||||||
if (source == null)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Null parameter.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.status = Status.ACTIVATED;
|
|
||||||
this.archiveDirectory = new File(source.getFileTreeDirectory(), ARCHIVE_PATH);
|
|
||||||
if (this.archiveDirectory.exists())
|
|
||||||
{
|
|
||||||
if (!this.archiveDirectory.isDirectory())
|
|
||||||
{
|
|
||||||
throw new SikevaDBException("Archive directory unavailable.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.archiveDirectory.mkdir();
|
|
||||||
}
|
|
||||||
this.database = source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#activate()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void activate()
|
|
||||||
{
|
|
||||||
this.status = Status.ACTIVATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#archive(fr.devinsy.sikevadb.core.Element)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void archive(final Element element) throws SikevaDBException
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#clear()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void clear() throws SikevaDBException
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#close()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the path.
|
|
||||||
*
|
|
||||||
* @return the path
|
|
||||||
*/
|
|
||||||
public File getPath()
|
|
||||||
{
|
|
||||||
return this.archiveDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#isActivated()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isActivated()
|
|
||||||
{
|
|
||||||
boolean result;
|
|
||||||
|
|
||||||
if (this.status == Status.ACTIVATED)
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#isSuspended()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isSuspended()
|
|
||||||
{
|
|
||||||
boolean result;
|
|
||||||
|
|
||||||
result = !isActivated();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#suspend()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void suspend()
|
|
||||||
{
|
|
||||||
this.status = Status.SUSPENDED;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2018 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,37 +22,35 @@ 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.xml.XMLBadFormatException;
|
import fr.devinsy.util.xml.XMLBadFormatException;
|
||||||
import fr.devinsy.xml.XMLReader;
|
import fr.devinsy.util.xml.XMLReader;
|
||||||
import fr.devinsy.xml.XMLWriter;
|
import fr.devinsy.util.xml.XMLWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class FileTreeSikevaDBTools.
|
*
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class FileTreeSikevaDBTools
|
public class FileTreeSikevaDBTools
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(FileTreeSikevaDBTools.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(FileTreeSikevaDBTools.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load element.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @return
|
||||||
* @return the element
|
* @throws FileNotFoundException
|
||||||
* @throws SikevaDBException
|
* @throws XMLStreamException
|
||||||
* the SikevaDB exception
|
* @throws XMLBadFormatException
|
||||||
*/
|
*/
|
||||||
public static Element loadElement(final File source) throws SikevaDBException
|
public static Element loadElement(final File source) throws SikevaDBException
|
||||||
{
|
{
|
||||||
|
@ -84,11 +82,11 @@ public class FileTreeSikevaDBTools
|
||||||
result.setId(id);
|
result.setId(id);
|
||||||
|
|
||||||
// private DateTime creationDate; IN
|
// private DateTime creationDate; IN
|
||||||
LocalDateTime creationDate = LocalDateTime.parse(in.readContentTag("creation_date").getContent());
|
DateTime creationDate = DateTime.parse(in.readContentTag("creation_date").getContent());
|
||||||
result.setCreationDate(creationDate);
|
result.setCreationDate(creationDate);
|
||||||
|
|
||||||
// private DateTime editionDate; IN
|
// private DateTime editionDate; IN
|
||||||
LocalDateTime editionDate = LocalDateTime.parse(in.readContentTag("edition_date").getContent());
|
DateTime editionDate = DateTime.parse(in.readContentTag("edition_date").getContent());
|
||||||
result.setEditionDate(editionDate);
|
result.setEditionDate(editionDate);
|
||||||
|
|
||||||
// private long size; IN
|
// private long size; IN
|
||||||
|
@ -139,14 +137,10 @@ public class FileTreeSikevaDBTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save element.
|
|
||||||
*
|
*
|
||||||
* @param target
|
* @param target
|
||||||
* the target
|
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
|
||||||
* @throws SikevaDBException
|
* @throws SikevaDBException
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
public static void saveElement(final File target, final Element source) throws SikevaDBException
|
public static void saveElement(final File target, final Element source) throws SikevaDBException
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,136 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2013-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.sql;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import fr.devinsy.sikevadb.core.Archiver;
|
|
||||||
import fr.devinsy.sikevadb.core.Element;
|
|
||||||
import fr.devinsy.sikevadb.core.SikevaDBException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class SQLArchiver.
|
|
||||||
*/
|
|
||||||
public class SQLArchiver implements Archiver
|
|
||||||
{
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SQLArchiver.class);;
|
|
||||||
|
|
||||||
private Status status;
|
|
||||||
private SQLSikevaDB database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new SQL archiver.
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* the source
|
|
||||||
*/
|
|
||||||
public SQLArchiver(final SQLSikevaDB source)
|
|
||||||
{
|
|
||||||
if (source == null)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Null parameter.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.status = Status.ACTIVATED;
|
|
||||||
this.database = source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#activate()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void activate()
|
|
||||||
{
|
|
||||||
this.status = Status.ACTIVATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#archive(fr.devinsy.sikevadb.core.Element)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void archive(final Element element) throws SikevaDBException
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#clear()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void clear() throws SikevaDBException
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#close()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#isActivated()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isActivated()
|
|
||||||
{
|
|
||||||
boolean result;
|
|
||||||
|
|
||||||
if (this.status == Status.ACTIVATED)
|
|
||||||
{
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#isSuspended()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isSuspended()
|
|
||||||
{
|
|
||||||
boolean result;
|
|
||||||
|
|
||||||
result = !isActivated();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see fr.devinsy.sikevadb.core.Archiver#suspend()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void suspend()
|
|
||||||
{
|
|
||||||
this.status = Status.SUSPENDED;
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2017 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,20 +22,18 @@ 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.strings.StringList;
|
import fr.devinsy.util.FileTools;
|
||||||
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SQLSikevaDBTools.
|
*
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
|
@ -44,19 +42,15 @@ public class SQLSikevaDBTools
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SQLSikevaDBTools.class);
|
private static final Logger logger = LoggerFactory.getLogger(SQLSikevaDBTools.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load SQL script.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
|
||||||
* @return the string list
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* Signals that an I/O exception has occurred.
|
|
||||||
*/
|
*/
|
||||||
public static StringList loadSQLScript(final URL source) throws IOException
|
public static StringList loadSQLScript(final URL source) throws IOException
|
||||||
{
|
{
|
||||||
StringList result;
|
StringList result;
|
||||||
|
|
||||||
String script = IOUtils.toString(source, StandardCharsets.UTF_8);
|
String script = FileTools.load(source);
|
||||||
|
|
||||||
result = splitSQLCommands(script);
|
result = splitSQLCommands(script);
|
||||||
|
|
||||||
|
@ -65,13 +59,9 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split SQL commands.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
|
||||||
* @return the string list
|
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* Signals that an I/O exception has occurred.
|
|
||||||
*/
|
*/
|
||||||
public static StringList splitSQLCommands(final String source) throws IOException
|
public static StringList splitSQLCommands(final String source) throws IOException
|
||||||
{
|
{
|
||||||
|
@ -100,16 +90,22 @@ 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(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,15 +121,13 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To date time.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @return
|
||||||
* @return the date time
|
|
||||||
*/
|
*/
|
||||||
public static LocalDateTime toDateTime(final java.sql.Timestamp source)
|
public static DateTime toDateTime(final java.sql.Timestamp source)
|
||||||
{
|
{
|
||||||
LocalDateTime result;
|
DateTime result;
|
||||||
|
|
||||||
if (source == null)
|
if (source == null)
|
||||||
{
|
{
|
||||||
|
@ -141,9 +135,7 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long seconds = source.getTime() / 1000;
|
result = new DateTime(source.getTime());
|
||||||
long nanos = (source.getTime() - seconds * 1000) * 1000000;
|
|
||||||
result = LocalDateTime.ofEpochSecond(seconds, (int) nanos, ZoneOffset.UTC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -151,11 +143,9 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To timestamp.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @return
|
||||||
* @return the java.sql. timestamp
|
|
||||||
*/
|
*/
|
||||||
public static java.sql.Timestamp toTimestamp(final Date source)
|
public static java.sql.Timestamp toTimestamp(final Date source)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +157,7 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = new java.sql.Timestamp(source.getTime() * 1000);
|
result = new java.sql.Timestamp(source.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -175,13 +165,11 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To timestamp.
|
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* the source
|
* @return
|
||||||
* @return the java.sql. timestamp
|
|
||||||
*/
|
*/
|
||||||
public static java.sql.Timestamp toTimestamp(final LocalDateTime source)
|
public static java.sql.Timestamp toTimestamp(final DateTime source)
|
||||||
{
|
{
|
||||||
java.sql.Timestamp result;
|
java.sql.Timestamp result;
|
||||||
|
|
||||||
|
@ -191,9 +179,7 @@ public class SQLSikevaDBTools
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long seconds = source.toEpochSecond(ZoneOffset.UTC);
|
result = new java.sql.Timestamp(source.getMillis());
|
||||||
long milliseconds = source.getNano() / 1000000;
|
|
||||||
result = new java.sql.Timestamp(seconds * 1000 + milliseconds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2017 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
* Copyright (C) 2013-2016 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,11 +27,9 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class BuildInformation.
|
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class BuildInformation
|
public class BuildInformation
|
||||||
{
|
{
|
||||||
private static class SingletonHolder
|
private static class SingletonHolder
|
||||||
|
@ -52,7 +50,7 @@ public class BuildInformation
|
||||||
private String buildAuthor;
|
private String buildAuthor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new builds the information.
|
*
|
||||||
*/
|
*/
|
||||||
private BuildInformation()
|
private BuildInformation()
|
||||||
{
|
{
|
||||||
|
@ -94,77 +92,46 @@ public class BuildInformation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the author.
|
|
||||||
*
|
*
|
||||||
* @return the string
|
* @return
|
||||||
*/
|
*/
|
||||||
public String buildAuthor()
|
public String buildAuthor()
|
||||||
{
|
{
|
||||||
return this.buildAuthor;
|
return this.buildAuthor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the date.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String buildDate()
|
public String buildDate()
|
||||||
{
|
{
|
||||||
return this.buildDate;
|
return this.buildDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the number.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String buildNumber()
|
public String buildNumber()
|
||||||
{
|
{
|
||||||
return this.buildNumber;
|
return this.buildNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generator.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String generator()
|
public String generator()
|
||||||
{
|
{
|
||||||
return this.generator;
|
return this.generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Major revision.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String majorRevision()
|
public String majorRevision()
|
||||||
{
|
{
|
||||||
return this.majorRevision;
|
return this.majorRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Minor revision.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String minorRevision()
|
public String minorRevision()
|
||||||
{
|
{
|
||||||
return this.minorRevision;
|
return this.minorRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Product name.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
public String productName()
|
public String productName()
|
||||||
{
|
{
|
||||||
return this.productName;
|
return this.productName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see java.lang.Object#toString()
|
*
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@ -178,9 +145,8 @@ public class BuildInformation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version.
|
|
||||||
*
|
*
|
||||||
* @return the string
|
* @return
|
||||||
*/
|
*/
|
||||||
public String version()
|
public String version()
|
||||||
{
|
{
|
||||||
|
@ -193,9 +159,8 @@ public class BuildInformation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance.
|
|
||||||
*
|
*
|
||||||
* @return the builds the information
|
* @return
|
||||||
*/
|
*/
|
||||||
public static BuildInformation instance()
|
public static BuildInformation instance()
|
||||||
{
|
{
|
||||||
|
@ -203,9 +168,7 @@ public class BuildInformation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is defined.
|
|
||||||
*
|
*
|
||||||
* @return true, if is defined
|
|
||||||
*/
|
*/
|
||||||
public static boolean isDefined()
|
public static boolean isDefined()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON, DEVINSY
|
* Copyright (C) 2013-2018 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.logging.log4j.Level;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
import org.apache.log4j.Level;
|
||||||
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -34,11 +34,10 @@ 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.sikevadb.core.XMLSikevaDB;
|
import fr.devinsy.sikevadb.core.UnopenedDatabaseException;
|
||||||
import fr.devinsy.strings.StringList;
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TreeFileSikevaDBTest.
|
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
|
@ -47,43 +46,8 @@ 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.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetKeyse01() throws Exception
|
public void testGetKeyse01() throws Exception
|
||||||
|
@ -107,16 +71,14 @@ public class TreeFileSikevaDBTest
|
||||||
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
database.put("alpha01s", "bravo5", "qlskjfmlqj");
|
||||||
|
|
||||||
Assert.assertEquals(0, database.getSubkeys("none").size());
|
Assert.assertEquals(0, database.getSubkeys("none").size());
|
||||||
|
Assert.assertEquals(5, database.getSubkeys("alpha01s").size());
|
||||||
|
|
||||||
//
|
//
|
||||||
logger.debug("===== test done.");
|
logger.debug("===== test done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test get keyse 02.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetKeyse02() throws Exception
|
public void testGetKeyse02() throws Exception
|
||||||
|
@ -139,22 +101,20 @@ 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.getTopKeys();
|
StringList keys = database.getKeys();
|
||||||
|
|
||||||
Assert.assertEquals(6, 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());
|
||||||
|
Assert.assertFalse(keys.contains("bravo4"));
|
||||||
|
|
||||||
//
|
//
|
||||||
logger.debug("===== test done.");
|
logger.debug("===== test done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test memory size 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMemorySize01() throws Exception
|
public void testMemorySize01() throws Exception
|
||||||
|
@ -193,10 +153,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPut01() throws Exception
|
public void testPut01() throws Exception
|
||||||
|
@ -216,10 +173,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 02.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPut02() throws Exception
|
public void testPut02() throws Exception
|
||||||
|
@ -240,10 +194,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 03.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test(expected = IllegalArgumentException.class)
|
||||||
public void testPut03() throws Exception
|
public void testPut03() throws Exception
|
||||||
|
@ -260,10 +211,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 04.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPut04() throws Exception
|
public void testPut04() throws Exception
|
||||||
|
@ -284,10 +232,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 05.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPut05() throws Exception
|
public void testPut05() throws Exception
|
||||||
|
@ -318,10 +263,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put 06.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPut06() throws Exception
|
public void testPut06() throws Exception
|
||||||
|
@ -353,10 +295,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put element 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPutElement01() throws Exception
|
public void testPutElement01() throws Exception
|
||||||
|
@ -372,9 +311,9 @@ public class TreeFileSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -388,10 +327,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put element 02.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPutElement02() throws Exception
|
public void testPutElement02() throws Exception
|
||||||
|
@ -409,9 +345,9 @@ public class TreeFileSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -425,10 +361,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test put element 03.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPutElement03() throws Exception
|
public void testPutElement03() throws Exception
|
||||||
|
@ -446,9 +379,9 @@ public class TreeFileSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -461,9 +394,9 @@ public class TreeFileSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -485,10 +418,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test random 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRandom01() throws Exception
|
public void testRandom01() throws Exception
|
||||||
|
@ -513,10 +443,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test remove 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRemove01() throws Exception
|
public void testRemove01() throws Exception
|
||||||
|
@ -548,10 +475,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test remove many 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveMany01() throws Exception
|
public void testRemoveMany01() throws Exception
|
||||||
|
@ -586,10 +510,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test rename key 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRenameKey01() throws Exception
|
public void testRenameKey01() throws Exception
|
||||||
|
@ -619,10 +540,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test size 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSize01() throws Exception
|
public void testSize01() throws Exception
|
||||||
|
@ -670,10 +588,7 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test tittle 01.
|
|
||||||
*
|
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* the exception
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTittle01() throws Exception
|
public void testTittle01() throws Exception
|
||||||
|
@ -693,32 +608,26 @@ public class TreeFileSikevaDBTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After class.
|
* @throws UnopenedDatabaseException
|
||||||
*
|
*
|
||||||
* @throws SikevaDBException
|
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClass() throws SikevaDBException
|
public static void afterClass() throws UnopenedDatabaseException
|
||||||
{
|
{
|
||||||
if (database != null)
|
if (database != null)
|
||||||
{
|
{
|
||||||
database.close();
|
database.close();
|
||||||
database.destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Before class.
|
|
||||||
*
|
|
||||||
* @throws SikevaDBException
|
* @throws SikevaDBException
|
||||||
* the SikevaDB exception
|
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws SikevaDBException
|
public static void beforeClass() throws SikevaDBException
|
||||||
{
|
{
|
||||||
Configurator.initialize(new DefaultConfiguration());
|
BasicConfigurator.configure();
|
||||||
Configurator.setRootLevel(Level.DEBUG);
|
Logger.getRootLogger().setLevel(Level.DEBUG);
|
||||||
|
|
||||||
// Add ?profileSQL=true to generate huge logs.
|
// Add ?profileSQL=true to generate huge logs.
|
||||||
|
|
||||||
|
@ -726,10 +635,10 @@ public class TreeFileSikevaDBTest
|
||||||
// "jdbc:mysql://localhost:3306/sikevadb-test", "sikevadb-test",
|
// "jdbc:mysql://localhost:3306/sikevadb-test", "sikevadb-test",
|
||||||
// "12345678");
|
// "12345678");
|
||||||
|
|
||||||
File homeDirectory = new File("/tmp/footest");
|
File rootDirectory = new File("/tmp/footest");
|
||||||
database = new FileTreeSikevaDB(homeDirectory, null, null);
|
database = new FileTreeSikevaDB(rootDirectory, null, null);
|
||||||
|
|
||||||
if (!database.exists())
|
if (!database.isCreated())
|
||||||
{
|
{
|
||||||
database.create();
|
database.create();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/**
|
||||||
* Copyright (C) 2013-2024 Christian Pierre MOMON, DEVINSY
|
* Copyright (C) 2013-2017 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,13 +18,12 @@
|
||||||
*/
|
*/
|
||||||
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.logging.log4j.Level;
|
import org.apache.log4j.BasicConfigurator;
|
||||||
import org.apache.logging.log4j.core.config.Configurator;
|
import org.apache.log4j.Level;
|
||||||
import org.apache.logging.log4j.core.config.DefaultConfiguration;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
@ -33,10 +32,9 @@ 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.strings.StringList;
|
import fr.devinsy.util.strings.StringList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SQLSikevaDBTest.
|
|
||||||
*
|
*
|
||||||
* @author Christian Pierre MOMON
|
* @author Christian Pierre MOMON
|
||||||
*/
|
*/
|
||||||
|
@ -62,9 +60,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -98,9 +96,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now());
|
element.setCreationDate(DateTime.now());
|
||||||
element.setEditionDate(LocalDateTime.now());
|
element.setEditionDate(DateTime.now());
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -171,7 +169,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.getTopKeys();
|
StringList keys = database.getKeys();
|
||||||
|
|
||||||
Assert.assertEquals(5, keys.size());
|
Assert.assertEquals(5, keys.size());
|
||||||
Assert.assertTrue(keys.contains("alpha03"));
|
Assert.assertTrue(keys.contains("alpha03"));
|
||||||
|
@ -380,9 +378,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -413,9 +411,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -447,9 +445,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -462,9 +460,9 @@ public class SQLSikevaDBTest
|
||||||
element.setSubkey(null);
|
element.setSubkey(null);
|
||||||
element.setSize(10);
|
element.setSize(10);
|
||||||
element.setDigest("qsdkfqskjf");
|
element.setDigest("qsdkfqskjf");
|
||||||
element.setCreationDate(LocalDateTime.now().minusDays(11));
|
element.setCreationDate(DateTime.now().minusDays(11));
|
||||||
element.setEditionDate(LocalDateTime.now().minusDays(11));
|
element.setEditionDate(DateTime.now().minusDays(11));
|
||||||
element.setArchiveDate(LocalDateTime.now().minusDays(10));
|
element.setArchiveDate(DateTime.now().minusDays(10));
|
||||||
element.setValue("bonjour");
|
element.setValue("bonjour");
|
||||||
|
|
||||||
database.put(element);
|
database.put(element);
|
||||||
|
@ -692,8 +690,8 @@ public class SQLSikevaDBTest
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws SikevaDBException
|
public static void beforeClass() throws SikevaDBException
|
||||||
{
|
{
|
||||||
Configurator.initialize(new DefaultConfiguration());
|
BasicConfigurator.configure();
|
||||||
Configurator.setRootLevel(Level.DEBUG);
|
Logger.getRootLogger().setLevel(Level.ERROR);
|
||||||
|
|
||||||
// Add ?profileSQL=true to generate huge logs.
|
// Add ?profileSQL=true to generate huge logs.
|
||||||
|
|
||||||
|
@ -702,7 +700,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.create();
|
|
||||||
database.open();
|
database.open();
|
||||||
|
database.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue