Compare commits

..

1 commit
main ... 0.5.1

Author SHA1 Message Date
28cf33e6cb Build 0.5.1 2023-05-09 18:31:54 +02:00
484 changed files with 26607 additions and 8707 deletions

View file

@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="owner.project.facets" value="java"/>
@ -18,28 +18,19 @@
<classpathentry kind="lib" path="lib/commons-text-1.9.jar" sourcepath="lib/commons-text-1.9-sources.jar"/>
<classpathentry kind="lib" path="lib/tika-core-1.24.1.jar" sourcepath="lib/tika-core-1.24.1-sources.jar"/>
<classpathentry kind="lib" path="lib/catgenerator-core-0.1.7.jar" sourcepath="lib/catgenerator-core-0.1.7-sources.zip"/>
<classpathentry kind="lib" path="lib/xidyn-1.11.2.jar" sourcepath="lib/xidyn-1.11.2-sources.zip"/>
<classpathentry kind="lib" path="lib/jOpenDocument-1.3.jar" sourcepath="lib/jOpenDocument-src-1.3.zip"/>
<classpathentry kind="lib" path="lib/threeten-extra-1.5.0.jar" sourcepath="lib/threeten-extra-1.5.0-sources.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.11.4.jar" sourcepath="lib/devinsy-strings-0.11.4-sources.zip"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.32.jar" sourcepath="lib/Logs/slf4j-api-1.7.32-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-api-2.17.1.jar" sourcepath="lib/Logs/log4j-api-2.17.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-core-2.17.1.jar" sourcepath="lib/Logs/log4j-core-2.17.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-slf4j-impl-2.17.1.jar" sourcepath="lib/Logs/log4j-slf4j-impl-2.17.1-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.11.0.jar" sourcepath="lib/commons-io-2.11.0-sources.jar"/>
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar" sourcepath="lib/json-simple-1.1.1-sources.jar"/>
<classpathentry kind="lib" path="lib/mariadb-java-client-3.0.3.jar"/>
<classpathentry kind="lib" path="lib/postgresql-42.3.3.jar"/>
<classpathentry kind="lib" path="lib/sqlite-jdbc-3.36.0.3.jar"/>
<classpathentry kind="lib" path="lib/mysql-jdbc-5.0.8.jar"/>
<classpathentry kind="lib" path="lib/devinsy-strings-0.17.0.jar" sourcepath="lib/devinsy-strings-0.17.0-sources.zip"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/apache-tomcat-10.1.12">
<attributes>
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/Logs/log4j-api-2.23.1.jar" sourcepath="lib/Logs/log4j-api-2.23.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-core-2.23.1.jar" sourcepath="lib/Logs/log4j-core-2.23.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-slf4j2-impl-2.23.1.jar" sourcepath="lib/Logs/log4j-slf4j2-impl-2.32.1-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-2.0.16.jar" sourcepath="lib/Logs/slf4j-api-2.0.16-sources.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

1
.gitignore vendored
View file

@ -2,4 +2,3 @@
/build
/dist
*~
/.apt_generated/

View file

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

View file

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
org.eclipse.jdt.apt.reconcileEnabled=true

View file

@ -11,9 +11,9 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -21,30 +21,20 @@ 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.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49
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_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=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_assertion_message=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_compact_if=16
@ -54,8 +44,6 @@ org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
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_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=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_module_statements=16
@ -64,7 +52,6 @@ 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_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_record_components=16
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
@ -75,10 +62,8 @@ 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_record_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=0
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_type_annotations=0
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
@ -127,7 +112,6 @@ org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags=false
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
@ -207,7 +191,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
@ -299,7 +282,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
@ -383,8 +365,6 @@ org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=200
@ -415,7 +395,6 @@ org.eclipse.jdt.core.formatter.text_block_indentation=0
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.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assertion_message_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
@ -425,6 +404,5 @@ org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -1,4 +1,3 @@
cleanup.add_all=false
cleanup.add_default_serial_version_id=false
cleanup.add_generated_serial_version_id=true
cleanup.add_missing_annotations=true
@ -8,78 +7,34 @@ cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=true
cleanup.also_simplify_lambda=true
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.array_with_curly=false
cleanup.arrays_fill=false
cleanup.bitwise_conditional_expression=false
cleanup.boolean_literal=false
cleanup.boolean_value_rather_than_comparison=true
cleanup.break_loop=false
cleanup.collection_cloning=false
cleanup.comparing_on_criteria=false
cleanup.comparison_statement=false
cleanup.controlflow_merge=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.convert_to_switch_expressions=false
cleanup.correct_indentation=true
cleanup.do_while_rather_than_while=true
cleanup.double_negation=false
cleanup.else_if=false
cleanup.embedded_if=false
cleanup.evaluate_nullable=false
cleanup.extract_increment=false
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.hash=false
cleanup.if_condition=false
cleanup.insert_inferred_type_arguments=false
cleanup.instanceof=false
cleanup.instanceof_keyword=false
cleanup.invert_equals=false
cleanup.join=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true
cleanup.map_cloning=false
cleanup.merge_conditional_blocks=false
cleanup.multi_catch=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true
cleanup.no_string_creation=false
cleanup.no_super=false
cleanup.number_suffix=false
cleanup.objects_equals=false
cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=true
cleanup.operand_factorization=false
cleanup.organize_imports=false
cleanup.overridden_assignment=false
cleanup.overridden_assignment_move_decl=true
cleanup.plain_replacement=false
cleanup.precompile_regex=false
cleanup.primitive_comparison=false
cleanup.primitive_parsing=false
cleanup.primitive_rather_than_wrapper=true
cleanup.primitive_serialization=false
cleanup.pull_out_if_from_if_else=false
cleanup.pull_up_assignment=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.reduce_indentation=false
cleanup.redundant_comparator=false
cleanup.redundant_falling_through_block_end=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
@ -92,36 +47,13 @@ cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_method_parameters=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.return_expression=false
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.single_used_field=false
cleanup.sort_members=true
cleanup.sort_members_all=false
cleanup.standard_comparison=false
cleanup.static_inner_class=false
cleanup.strictly_equal_or_different=false
cleanup.stringbuffer_to_stringbuilder=false
cleanup.stringbuilder=false
cleanup.stringbuilder_for_local_vars=true
cleanup.stringconcat_stringbuffer_stringbuilder=false
cleanup.stringconcat_to_textblock=false
cleanup.substring=false
cleanup.switch=false
cleanup.system_property=false
cleanup.system_property_boolean=false
cleanup.system_property_file_encoding=false
cleanup.system_property_file_separator=false
cleanup.system_property_line_separator=false
cleanup.system_property_path_separator=false
cleanup.ternary_operator=false
cleanup.try_with_resource=false
cleanup.unlooped_while=false
cleanup.unreachable_block=false
cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true
@ -129,22 +61,18 @@ cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_string_is_blank=false
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_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup.useless_continue=false
cleanup.useless_return=false
cleanup.valueof_rather_than_instantiation=false
cleanup_profile=_StaoolInfos
cleanup_profile=_StatoolInfos
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_StatoolInfos
formatter_settings_version=23
formatter_settings_version=19
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
@ -152,8 +80,6 @@ org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
org.eclipse.jdt.ui.text.custom_code_templates=
sp_cleanup.add_all=false
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
@ -163,79 +89,35 @@ sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.also_simplify_lambda=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=true
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.array_with_curly=false
sp_cleanup.arrays_fill=false
sp_cleanup.bitwise_conditional_expression=false
sp_cleanup.boolean_literal=false
sp_cleanup.boolean_value_rather_than_comparison=false
sp_cleanup.break_loop=false
sp_cleanup.collection_cloning=false
sp_cleanup.comparing_on_criteria=false
sp_cleanup.comparison_statement=false
sp_cleanup.controlflow_merge=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
sp_cleanup.convert_to_switch_expressions=false
sp_cleanup.correct_indentation=true
sp_cleanup.do_while_rather_than_while=false
sp_cleanup.double_negation=false
sp_cleanup.else_if=false
sp_cleanup.embedded_if=false
sp_cleanup.evaluate_nullable=false
sp_cleanup.extract_increment=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.hash=false
sp_cleanup.if_condition=false
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.instanceof=false
sp_cleanup.instanceof_keyword=false
sp_cleanup.invert_equals=false
sp_cleanup.join=false
sp_cleanup.lazy_logical_operator=false
sp_cleanup.make_local_variable_final=false
sp_cleanup.make_parameters_final=true
sp_cleanup.make_private_fields_final=false
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=true
sp_cleanup.map_cloning=false
sp_cleanup.merge_conditional_blocks=false
sp_cleanup.multi_catch=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.no_string_creation=false
sp_cleanup.no_super=false
sp_cleanup.number_suffix=false
sp_cleanup.objects_equals=false
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.one_if_rather_than_duplicate_blocks_that_fall_through=false
sp_cleanup.operand_factorization=false
sp_cleanup.organize_imports=true
sp_cleanup.overridden_assignment=false
sp_cleanup.overridden_assignment_move_decl=false
sp_cleanup.plain_replacement=false
sp_cleanup.precompile_regex=false
sp_cleanup.primitive_comparison=false
sp_cleanup.primitive_parsing=false
sp_cleanup.primitive_rather_than_wrapper=false
sp_cleanup.primitive_serialization=false
sp_cleanup.pull_out_if_from_if_else=false
sp_cleanup.pull_up_assignment=false
sp_cleanup.push_down_negation=false
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.reduce_indentation=false
sp_cleanup.redundant_comparator=false
sp_cleanup.redundant_falling_through_block_end=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_modifiers=false
sp_cleanup.remove_redundant_semicolons=false
@ -248,36 +130,13 @@ sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=true
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_method_parameters=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.return_expression=false
sp_cleanup.simplify_lambda_expression_and_method_ref=false
sp_cleanup.single_used_field=false
sp_cleanup.sort_members=true
sp_cleanup.sort_members_all=false
sp_cleanup.standard_comparison=false
sp_cleanup.static_inner_class=false
sp_cleanup.strictly_equal_or_different=false
sp_cleanup.stringbuffer_to_stringbuilder=false
sp_cleanup.stringbuilder=false
sp_cleanup.stringbuilder_for_local_vars=false
sp_cleanup.stringconcat_stringbuffer_stringbuilder=false
sp_cleanup.stringconcat_to_textblock=false
sp_cleanup.substring=false
sp_cleanup.switch=false
sp_cleanup.system_property=false
sp_cleanup.system_property_boolean=false
sp_cleanup.system_property_file_encoding=false
sp_cleanup.system_property_file_separator=false
sp_cleanup.system_property_line_separator=false
sp_cleanup.system_property_path_separator=false
sp_cleanup.ternary_operator=false
sp_cleanup.try_with_resource=false
sp_cleanup.unlooped_while=false
sp_cleanup.unreachable_block=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_autoboxing=false
sp_cleanup.use_blocks=true
@ -285,16 +144,12 @@ sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_directly_map_method=false
sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_string_is_blank=false
sp_cleanup.use_this_for_non_static_field_access=true
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
sp_cleanup.use_unboxing=false
sp_cleanup.use_var=false
sp_cleanup.useless_continue=false
sp_cleanup.useless_return=false
sp_cleanup.valueof_rather_than_instantiation=false
sp_jautodoc.cleanup.add_header=false
sp_jautodoc.cleanup.javadoc=false
sp_jautodoc.cleanup.replace_header=false

View file

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="StatooInfos">
<wb-module deploy-name="SikevaDB">
<wb-resource deploy-path="/" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/test"/>
<wb-resource deploy-path="/" source-path="/.apt_generated"/>
</wb-module>
</project-modules>

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="apache-tomcat-10.1.12"/>
<fixed facet="java"/>
<fixed facet="jst.utility"/>
<installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="17"/>
<installed facet="java" version="11"/>
</faceted-project>

View file

@ -6,50 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
Changes for metrics:
- …
## [0.6.1] - 2024-09-23
- Fixed bad log init with no configuration file.
- Fixed StackOverflowError case in AccessLog regex.
- Improved Javadoc and added test for isPage method.
- Fixed Java version in build script.
- Fixed label in script build.sh.
- Upgraded log4j libs from 1.7.32 to 2.23.1.
- Improved main README and resources files.
- Improved documentation.
- Improved build script.
## [0.6.0] - 2024-08-17
Change major number because of split web event.
Changes for metrics:
- Deleted no longer targeted GSL service.
- Made Javadoc review and header review.
- Increased version after the splitweb step.
- Added CrawlCache expired management feature.
- Updated the README text.
- Added categories file from CHATONS stats workgroup with Angie from Framasoft, MrFlo and Cpm.
- Improved the federation time load (> x200).
- Huge optimization in the property check.
- Removed htmlize target directory conf.
- Migrated from Java 11 to Java 17.
- Split htmlize command code to statoolinfosweb project.
- Added new error log parameter description for configuration file.
- Fixed property label.
- Fixed parsing of \" in "" for http access logs. Less unrecognized http logs.
- Refactored http error log metrics.
- Added list errfile and list errlog CLI commands.
- Improved tests.
- Improved package naming.
- Added configuration file for list and stats CLI commands.
- Added HttpAccessLogDateTimePattern management (#sleto).
- Improved user agent bot list.
Changes for web building:
- SPLITWEB: no more web building! See the StatoolInfosWeb project.
- …
## [0.5.1] 2023-05-09

277
README.md
View file

@ -20,6 +20,13 @@ I am glad to use the beautiful artwork of David Revoy (http://www.peppercarrot.c
* Source: https://framagit.org/Deevad/cat-avatar-generator
* Originally inspired of the code for "MonsterID" by Andreas Gohr http://www.splitbrain.org/go/monsterid.
### Circle-icons
I am glad to use the generous artwork of ElegantThemes.com :
* https://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free
* "These icons are completely free and Open Source under the GPL".
### Logo
@ -30,7 +37,11 @@ License: Creative Commons CC BY-SA last version.
### Other stuff
License of other stuff: without any specific information, default license of images is CC BY-SA 3+.
License of other stuff:
* csv-logo.svg, json-logo.svg, ods-icon.svg:
* Author: Christian P. Momon
* License: CC BY-SA 3+.
* other: without any specific information, default license of images is CC BY-SA 3+.
## DOCUMENTATION
@ -39,48 +50,20 @@ Read CONCEPT.md and ONTOLOGY.md files.
## Requirements
- Java 17
- Eclipse 4.29 (2023-09).
- Java 11
- Eclipse 4.16 (202006).
## INSTALL
Install Java on Debian:
Install Java :
```
apt-get install openjdk-17-jre-headless
apt-get install openjdk-11-jre-headless
```
Download the last release: `https://forge.devinsy.fr/statool/statoolinfos/releases` and unzip the package.
Download the last release: https://forge.devinsy.fr/devinsy/statoolinfos/releases
The `srv/` directory is a example of deployment tree:
```
srv/
srv/statoolinfos
srv/statoolinfos/bin
srv/statoolinfos/bin/refresh
srv/statoolinfos/bin/probe
srv/statoolinfos/bin/uptime
srv/statoolinfos/bin/statoolinfos.sh
srv/statoolinfos/bin/crawl
srv/statoolinfos/conf
srv/statoolinfos/conf/sample-probe-http.conf
srv/statoolinfos/conf/log4j2-default.properties
srv/statoolinfos/conf/sample-probe-minetest.conf
srv/statoolinfos/conf/sample-federation.conf
srv/statoolinfos/conf/sample-probe-qrcode.conf
srv/statoolinfos/cache
srv/statoolinfos/statoolinfos-cron.log
srv/statoolinfos/well-known
srv/statoolinfos/well-known/statoolinfos
srv/statoolinfos/well-known/statoolinfos/organization-template.properties
srv/statoolinfos/well-known/statoolinfos/services.properties
srv/statoolinfos/well-known/statoolinfos/BOM
srv/statoolinfos/well-known/statoolinfos/federation-template.properties
srv/statoolinfos/well-known/statoolinfos/service-template.properties
```
Then, move the `statoolinfos.jar` file in `/srv/statoolinfos/bin/`.
Unzip the package and move the `statoolinfos.jar` and `statoolinfo.sh` files in `/srv/statoolinfos/bin/`.
Create link:
@ -88,15 +71,6 @@ Create link:
cd /srv/statoolinfos/bin/ ; ln -s statoolinfos.sh statoolinfos
```
Edit script in `/srv/statoolinfos/bin/` to target your federation configuration file.
In case of bad language output, add these lines on top of cron file:
```
LANGUAGE=en_EN.UTF8
LC_ALL=en_EN.UTF-8
```
## Usage
@ -109,7 +83,7 @@ Usage:
statoolinfos clear <configurationfile> remove property files from conf
statoolinfos crawl <configurationfile> crawl all file from conf and input
statoolinfos format <fileordirectory> format property files in tiny way
s̶t̶a̶t̶o̶o̶l̶i̶n̶f̶o̶s̶ ̶h̶t̶m̶l̶i̶z̶e̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶<̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶f̶i̶l̶e̶>̶ ̶ ̶ ̶ ̶ ̶g̶e̶n̶e̶r̶a̶t̶e̶ ̶w̶e̶b̶ ̶p̶a̶g̶e̶s̶ ̶f̶r̶o̶m̶ ̶c̶o̶n̶f̶ REMOVED since splitweb
statoolinfos htmlize <configurationfile> generate web pages from conf
statoolinfos probe OPTION [<directory>|<configurationfile>] generate metrics files from conf
OPTION = [-full|-today|-previousday|-NN] with NN a day count
statoolinfos tagdate <fileordirectory> update the file.datetime file
@ -117,173 +91,18 @@ Usage:
statoolinfos list file <logfilesorconfigfile> display http access log files
statoolinfos list log [-bot|-nobot] <logfilesorconfigfile> display http access log lines
statoolinfos list ip [-bot|-nobot] <logfilesorconfigfile> generate ip list from http log file
statoolinfos list ua [-bot|-nobot] <logfilesorconfigfile> generate user agent list from http log file
statoolinfos list visitor [-bot|-nobot] <logfilesorconfigfile> generate visitors (ip+ua) list from http log file
statoolinfos stat ip [-bot|-nobot] <logfilesorconfigfile> generate stats about ip from http log file
statoolinfos stat ua [-bot|-nobot] <logfilesorconfigfile> generate stats about user agent from http log file
statoolinfos stat visitor [-bot|-nobot] <logfilesorconfigfile> generate stats about visitor (ip+ua) from http log file
statoolinfos list errfile <logfilesorconfigfile> display http error log files
statoolinfos list errlog <logfilesorconfigfile> display http error log lines
```
## Simple federation configuration file
Example of `libre-service.eu.conf`:
```
# [Configuration] conf + organization + services + machines + metrics
conf.class=federation
conf.protocol=StatoolInfos-0.6.0
conf.crawl.input=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu.properties
conf.crawl.cache=/srv/statoolinfos/cache/
```
The field `input` gives the federation properties URL file. Reminder, the StatoolInfos Protocol requires that the federation properties file is exposed on the Web.
The field `cache` gives local directory used as data cache.
## Crawl
The `statoolinfos crawl` command loads the federation configuration file, then downloads the federation properties file and download all files set in.
In case of use with StatoolInfosWeb, never forget to give read permissions to Tomcat server. So, create a dedicated script would help.
Example of script `/srv/statoolinfos/bin/crawl`:
```
#!/bin/bash
echo "========== CRAWL at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos crawl ../conf/federation.conf
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache
```
Example of cron configuration `/etc/cron.d/statoolinfos`:
```
4 * * * * root /srv/statoolinfos/bin/crawl >> /srv/statoolinfos/statoolinfos-cron.log
```
Adjust your frequency according to your need. In case of large federation, once an hour is a good compromise.
## Uptime
The `statoolinfos uptime` command is very useful to collect the uptime of services. It's just to share which services are down and since how many time. It is not a monitoring feature because an one hour check is enough for this. Actually, only website are checked.
In case of use with StatoolInfosWeb, never forget to give read permissions to Tomcat server. So, create a dedicated script would help.
Example of script `/srv/statoolinfos/bin/uptime`:
```
#!/bin/bash
echo "========== UPTIME at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos uptime ../conf/federation.conf
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache
```
Example of cron configuration `/etc/cron.d/statoolinfos`:
```
4 * * * * root /srv/statoolinfos/bin/uptime >> /srv/statoolinfos/statoolinfos-cron.log
```
One check per hour is a good idea. In the uptime page, the mouse over a yellow status icon show the list of the check results.
In case of crawl, uptime and probe cron on the same computer, you can have different cron frequencies. It is better to have only script for call all them:
```
#!/bin/bash
echo "========== REFRESH at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./probe
./crawl
./uptime
#./htmlize
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache
```
And so your cron can be like that:
```
4 0,12,23 * * * root /srv/statoolinfos/bin/refresh >> /srv/statoolinfos/statoolinfos-cron.log
4 1-11,13-22 * * * root /srv/statoolinfos/bin/uptime >> /srv/statoolinfos/statoolinfos-cron.log
statoolinfos list ip [-bot|-nobot] <logfiles> generate ip list from http log file
statoolinfos list ua [-bot|-nobot] <logfiles> generate user agent list from http log file
statoolinfos list visitor [-bot|-nobot] <logfiles> generate visitors (ip+ua) list from http log file
statoolinfos stat ip [-bot|-nobot] <logfiles> generate stats about ip from http log file
statoolinfos stat ua [-bot|-nobot] <logfiles> generate stats about user agent from http log file
statoolinfos stat visitor [-bot|-nobot] <logfiles> generate stats about visitor (ip+ua) from http log file
```
## Htmlize command **removed**
## Generate metrics files
The `statoolinfos htmlize` command is removed since 2024-07.
As a reminder, the htmlize command generated absolutely all the pages needed for a static website.
As the number of pages generated became too large (> 10000 with 100 organizations), the decision was made to separate the html valuation into a separate project, StatoolInfosWeb.
A dynamic web site allows to generate page only when it is necessary.
## Probe (Generate metrics files)
### Basics
The `statoolinfos probe` command computes data sources to generate metric properties files. In case of already existings file, the data are loaded before the computation to be updated.
In case of use with StatoolInfosWeb, never forget to give read permissions to Tomcat server. So, create a dedicated script would help.
Example of script `/srv/statoolinfos/bin/probe`:
```
#!/bin/bash
echo "========== PROBE at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos probe -previousday ../conf/
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache
```
Note: set a specific configuration file is not necessary, because you can have multiple service to probe. Only probe configuration files will be manage.
Example of cron configuration `/etc/cron.d/statoolinfos`:
```
4 * * * * root /srv/statoolinfos/bin/probe >> /srv/statoolinfos/statoolinfos-cron.log
```
### HTTP Server configuration
The probe feature generates properties files to expose on web. StatoolInfos protocol recommends to follow the well-known convention.
Example of `/etc/apache2/statoolinfos.conf` generic configuration file:
```
Alias "/.well-known/statoolinfos/" "/srv/statoolinfos/well-known/statoolinfos/"
<Directory "/srv/statoolinfos/well-known/statoolinfos">
Options +Indexes
Require all granted
</Directory>
```
Example of include directive in `/etc/apache2/sites-enabled/myservice.conf`:
```
<VirtualHost *:443>
[…]
Include statoolinfos.conf
[…]
</VirtualHost>
```
### Sample configuration file
### Basics
Create a configuration file `/srv/statoolInfos/conf/foo.bar.org.conf`:
@ -304,7 +123,7 @@ Generate the metric file for the first time:
Create a cron file in `/etc/cron.d/statoolinfos` to update the metric file everyday:
```
4 0,12 * * * root /srv/statoolinfos/bin/statoolinfos probe -previousday /srv/statoolinfos/conf/foo.bar.org.conf >> /srv/statoolinfos/cron.log
1 0,12 * * * root /srv/statoolinfos/bin/statoolinfos probe -previousday /srv/statoolinfos/conf/foo.bar.org.conf >> /srv/statoolinfos/cron.log
```
In case of several configuration files, just set the configuration directory (without wildcard):
@ -368,6 +187,16 @@ conf.probe.gitea.database.password=
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
```
### GSL metrics
Configuration template:
```
conf.probe.types=GSL
conf.probe.gsl.stats=/foo/bar/stats.properties
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
```
### LibreQR metrics
Configuration template:
@ -449,31 +278,17 @@ conf.probe.httperrorlog.file=/var/log/apache2/foo.bar.org-error.log*,/var/log/ap
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
# Custom access log pattern with Java regex.
# Default: ^(?<remoteAddress>[a-fA-F0-9\:\.]+) - (?<remoteUser>[^\[]+) \[(?<time>[^\]]+)\] "(?<request>([^\"]|\")*)" (?<status>\d+) (?<bodyBytesSent>\d+) "(?<referer>([^\"]|\")*)" "(?<userAgent>([^\"]|\")*)".*$
# Default: ^(?<remoteAddress>[a-fA-F0-9\:\.]+) - (?<remoteUser>[^\[]+) \[(?<time>[^\]]+)\] "(?<request>.*)" (?<status>\d+) (?<bodyBytesSent>\d+) "(?<referer>.*)" "(?<userAgent>[^"]*)".*$
conf.probe.httpaccesslog.pattern=
# Custom datetime access log pattern (https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns). The language ID is mandatory.
# Default: dd/MMM/yyyy:HH:mm:ss Z|EN
conf.prob.httpaccesslog.datetimepattern=
# Filter request with Java regex (without the initial '^' and without the final '$', see https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).
# Example: pathfilter=/.*well-known.*
conf.probe.httpaccesslog.pathfilter=
# Custom error log pattern with Java regex. By default, automatic detection.
# Default Apache: ^\[(?<time>[^\]]+)\]\s\[(?<level>[^\]]*)\]\s(?<message>.*)$
# Default NGinx: ^(?<time>\S+\s\S+)\s\[(?<level>[^\]]*)\]\s(?<message>.*)$
conf.probe.httperrorlog.pattern=
# Custom datetime access log pattern (https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns). The language ID is mandatory.
# Default: dd/MMM/yyyy:HH:mm:ss Z|EN
conf.prob.httperrorlog.datetimepattern=
```
Warning: to have month metric values, you have to set **retention log to 7 weeks or 50 days** in Nginx or Apache logrotate configuration.
For Nginx, éditer le fichier `/etc/logrotate.d/nginx` :
```
/var/log/nginx/*.log {
weekly
@ -482,23 +297,9 @@ For Nginx, éditer le fichier `/etc/logrotate.d/nginx` :
```
For Apache, éditer le fichier `/etc/logrotate.d/apache2` :
```
/var/log/apache2/*.log {
weekly
missingok
rotate 7
```
### Cron all task
A situation you will encounter is the need to do several tasks from the same machine. In this case, avoid multiple cron in the same time. Put all in Bash script and call it with only one cron.
Example:
```
4 0,12,23 * * * root /srv/statoolinfos/bin/refresh >> /srv/statoolinfos/statoolinfos-cron.log
4 1-11,13-22 * * * root /srv/statoolinfos/bin/statoolinfos uptime /srv/statoolinfos/conf/libre-service.eu.conf >> /srv/statoolinfos/statoolinfos-cron.log
```

View file

@ -57,8 +57,6 @@
<!-- ***** JavaDoc ***** -->
<target name="javadoc" description="Javadoc construction">
<javadoc sourcepath="${build.src}" destdir="${build.javadoc}">
<arg value="-Xmaxwarns"/>
<arg value="500"/>
<classpath>
<fileset dir="lib" includes="**/*.jar" />
</classpath>
@ -126,22 +124,16 @@
<!-- Copy stuff -->
<echo message="==========> Copy Stuff" />
<copy file="resources/scripts/${product.name}.sh" todir="${dist.dir}/" overwrite="true" />
<chmod file="${dist.dir}/${product.name}.sh" perm="ugo+rx" />
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" failonerror="false" />
<!--copy file="README" todir="${dist.dir}/" overwrite="true" failonerror="false" /-->
<copy file="README.md" todir="${dist.dir}/" overwrite="true" failonerror="false" />
<!--copy file="scripts/log4j.properties" todir="${dist.dir}/" overwrite="true" /-->
<mkdir dir="${dist.dir}/srv" />
<copy todir="${dist.dir}/srv/" overwrite="true" failonerror="false">
<fileset dir="resources/srv" includes="**" />
</copy>
<echo message="==========>ZZZZ" />
<mkdir dir="${dist.dir}/conf" />
<copy todir="${dist.dir}/conf">
<fileset dir="${basedir}/resources/conf" includes="**" />
<fileset dir="${basedir}/resources/conf" includes="*" />
</copy>
<!--
<mkdir dir="${dist.dir}/man"/>

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Mon Sep 23 04:40:53 CEST 2024
#Tue May 09 18:31:49 CEST 2023
build.number=2

View file

@ -1,4 +1,4 @@
product.name=statoolinfos
product.revision.major=0
product.revision.minor=6
product.revision.minor=5
product.revision.snapshot=

121
build.sh
View file

@ -5,7 +5,7 @@
#
function help
{
echo "Build script."
echo "StatoolInfos build script."
echo "Usage: build.sh [ -h | -help | --help | -snapshot | -local | -full ]"
echo " -h, -help, --help display this help."
echo " -snapshot, --snapshot build a snapshot."
@ -15,9 +15,9 @@ function help
}
#
# Check env.
# Build snapshot.
#
function check_env
function build_snapshot
{
okCount=0
@ -40,13 +40,96 @@ function check_env
fi
# Java version check.
JAVA_VERSION=17;
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ ${JAVA_VERSION}. ]]; then
echo "Java ${JAVA_VERSION} version requirement..... OK"
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
echo "Java ${JAVA_VERSION} version requirement..... MISSING"
echo "Java 11 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
echo "Requirement OK"
ant -f build-snapshot.xml
else
echo "Requirement MISSING, build abort"
fi
}
#
# Build local.
#
function build_local
{
okCount=0
# Ant check.
antCheck=`which ant`
if [[ "$antCheck" =~ ^/.* ]]; then
echo "Ant requirement................ OK"
let "okCount+=1"
else
echo "Ant requirement................ MISSING"
fi
# Javac check.
javacCheck=`which javac`
if [[ "$javacCheck" =~ ^/.* ]]; then
echo "Javac requirement.............. OK"
let "okCount+=1"
else
echo "Javac requirement.............. MISSING"
fi
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
fi
if [ "$okCount" == 3 ]; then
echo "Requirement OK"
ant -f build-local.xml
else
echo "Requirement MISSING, build abort"
fi
}
#
# Build tagandpush.
#
function build_tagandpush
{
okCount=0
# Ant check.
antCheck=`which ant`
if [[ "$antCheck" =~ ^/.* ]]; then
echo "Ant requirement................ OK"
let "okCount+=1"
else
echo "Ant requirement................ MISSING"
fi
# Javac check.
javacCheck=`which javac`
if [[ "$javacCheck" =~ ^/.* ]]; then
echo "Javac requirement.............. OK"
let "okCount+=1"
else
echo "Javac requirement.............. MISSING"
fi
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
echo "Java 11 version requirement..... MISSING"
fi
# Git check.
@ -60,28 +143,26 @@ function check_env
if [ "$okCount" == 4 ]; then
echo "Requirement OK"
ant -f build-tagandpush.xml
else
echo "Requirement MISSING, build abort"
exit -1
fi
}
#
# Main.
#
if [ "$#" -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ]; then
help
elif [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
build_snapshot
elif [ "$1" == "-local" ] || [ "$1" == "--local" ] ; then
build_local
elif [ "$1" == "-tagandpush" ] || [ "$1" == "--tagandpush" ] ; then
build_tagandpush
else
check_env
if [ "$1" == "-snapshot" ] || [ "$1" == "--snapshot" ] ; then
ant -f build-snapshot.xml
elif [ "$1" == "-local" ] || [ "$1" == "--local" ] ; then
ant -f build-local.xml
elif [ "$1" == "-tagandpush" ] || [ "$1" == "--tagandpush" ] ; then
ant -f build-tagandpush.xml
else
echo "Invalid parameters."
help
fi
echo "Invalid parameters."
help
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,10 +1,9 @@
Description of used libraries:
- Logs/
- log4j-api log API
- log4j-core
- log4j-slf4j-impl adaptation layer between slf4j and log4j
- log4j log API
- slf4j-api facade log API
- slf4j-log4j12 adaptation layer between slf4j and log4j
- UnitTesting/
- hamcrest-core required by junit

Binary file not shown.

BIN
lib/xidyn-1.11.2.jar Normal file

Binary file not shown.

View file

@ -1 +0,0 @@
See the `srv/statoolinfos/conf` directory.

View file

@ -19,6 +19,6 @@ conf.probe.httpaccesslog.pattern=
conf.probe.httperrorlog.file=/var/log/apache2/qrcode.libre-service.eu/qrcode.libre-service.eu-error.log*
# Target file to write computed metrics. If file exists then it is renamed with '.bak'.
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/qrcode.libre-service.eu-metrics.properties
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/qrcode.libre-service.eu.metrics

View file

@ -20,4 +20,4 @@ conf.probe.minetest.players.db.password=
conf.probe.minetest.datafilepath=
# Target file to write computed metrics. If file exists then it is renamed with '.bak'.
conf.probe.target=/srv/statoolinfos/well-known/statoolinfo/www.myservice.org-metrics.properties
conf.probe.target=/home/cpm/Projets/StatoolInfos/EnvTest/minetest/test.metrics

View file

@ -0,0 +1,14 @@
#
# Sample StatoolInfos config file.
#
# Warning: move this file outside the Git directory.
conf.class=federation
conf.protocol=StatoolInfos-0.5.0
conf.crawl.input=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu.properties
conf.crawl.cache=/srv/statoolinfos/cache/
conf.htmlize.categories=/srv/statoolinfos/inputs/categories/categories.properties
conf.htmlize.input=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu.properties
conf.htmlize.directory=/srv/statoolinfos/www/

View file

@ -0,0 +1,3 @@
LANGUAGE=fr_FR.UTF8
LC_ALL=fr_FR.UTF-8
/5 * * * * root /srv/statoolinfos/bin/statoolinfo.sh >> /srv/statoolinfos/statoolinfos-cron.log

View file

@ -1,5 +0,0 @@
Alias "/.well-known/statoolinfos/" "/srv/statoolinfos/well-known/statoolinfos/"
<Directory "/srv/statoolinfos/well-known/statoolinfos">
Options +Indexes
Require all granted
</Directory>

View file

@ -1,2 +0,0 @@
4 0,12,23 * * * root /srv/statoolinfos/bin/refresh >> /srv/statoolinfos/statoolinfos-cron.log
4 1-11,13-22 * * * root /srv/statoolinfos/bin/uptime >> /srv/statoolinfos/statoolinfos-cron.log

View file

@ -1,7 +0,0 @@
#!/bin/bash
echo "========== CRAWL at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos crawl ../conf/federation.conf
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache

View file

@ -1,7 +0,0 @@
#!/bin/bash
echo "========== PROBE at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos probe -previousday ../conf/
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache

View file

@ -1,10 +0,0 @@
#!/bin/bash
echo "========== REFRESH at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./probe
./crawl
./uptime
#./htmlize
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache

View file

@ -1,22 +0,0 @@
#!/bin/bash
# Optional environment settings:
# export LOG4J_CONFIGURATION_FILE="toto.properties"
# export LOG4J_LEVEL=ERROR
# https://logging.apache.org/log4j/log4j-2.11.2/manual/configuration.html#System_Properties
# Java check.
javaCheck=`which java`
if [[ "$javaCheck" =~ ^/.* ]]; then
#echo "Java requirement............... OK"
# Optional system properties:
# LOGFILE="-Dlog4j2.configurationFile=../../log4j2.properties"
# LOGLEVEL="-Dlog4j2.level=ERROR"
# IPV6ONLY="-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true"
# https://logging.apache.org/log4j/log4j-2.11.2/manual/configuration.html#System_Properties
java -Djava.awt.headless=true $IPV6ONLY $LOGFILE $LOGLEVEL -jar "$(dirname "$0")"/statoolinfos.jar $@
else
echo "Java requirement............... MISSING"
fi

View file

@ -1,7 +0,0 @@
#!/bin/bash
echo "========== UPTIME at $(date --iso-8601=seconds)"
cd $(dirname "$0")
./statoolinfos uptime ../conf/federation.conf
chmod -R g+r /srv/statoolinfos/cache
chgrp -R tomcat /srv/statoolinfos/cache

View file

@ -1,8 +0,0 @@
# [Configuration]
conf.class=federation
conf.protocol=StatoolInfos-0.6.0
conf.crawl.input=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu.properties
conf.crawl.cache=/srv/statoolinfos/cache/

View file

@ -1,8 +0,0 @@
# [Configuration]
conf.class=service
conf.protocol=StatoolInfos-0.6.0
conf.probe.types=HttpAccessLog, HttpErrorLog
conf.probe.httpaccesslog.file=/var/log/apache2/www.libre-service.eu/www.libre-service.eu-access.log*
conf.probe.httperrorlog.file=/var/log/apache2/www.libre-service.eu/www.libre-service.eu-error.log*
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/www.libre-service.eu-metrics.properties

View file

@ -1,87 +0,0 @@
# federation.properties
# [File]
# Classe du fichier (valeur parmi {Federation, Organization, Service, Device}, obligatoire).
file.class = federation
# Version de l'ontologie utilisée utilisé (type STRING, recommandé).
file.protocol = ChatonsInfos-0.5
# Date et horaire de génération du fichier (type DATETIME, recommandé, ex. 2020-07-06T14:23:20).
file.datetime =
# Nom du générateur du fichier (type STRING, recommandé).
file.generator =
# [Federation]
# Nom de la fédération (type STRING, obligatoire).
federation.name=
# Description de la fédération (type STRING, recommandé).
federation.description =
# Lien du site web de la fédération (type URL, recommandé).
federation.website =
# Lien du logo de la fédération (type URL, recommandé).
federation.logo =
# Lien de la page web de contact de la fédération (type URL, recommandé).
federation.contact.url =
# Courriel de contact de la fédération (type EMAIL, recommandé).
federation.contact.email =
# Lien du compte Twitter de la fédération (type URL, optionnel).
federation.socialnetworks.twitter =
# Lien de la page Facebook de la fédération (type URL, optionnel).
federation.socialnetworks.facebook =
# Lien du compte Mastodon de la fédération (type URL, optionnel).
federation.socialnetworks.mastodon =
# Lien du compte Diaspora de la fédération (type URL, optionnel).
federation.socialnetworks.diaspora =
# Lien du compte PeerTube de la fédération(type URL, optionnel).
federation.socialnetworks.peertube =
# Lien du compte Funkwhale de la fédération (type URL, optionnel).
federation.socialnetworks.funkwhale =
# Lien du compte Pixelfeld de la fédération (type URL, optionnel).
federation.socialnetworks.pixelfeld =
# Lien du compte Mobilizon de la fédération (type URL, optionnel).
federation.socialnetworks.mobilizon =
# Lien de la page web des mentions légales de la fédération (type URL, recommandé).
federation.legal.url =
# Lien de la documentation web de la fédération (type URL, recommandé).
federation.documentation.url =
# Lien de la documentation technique de la fédération (type URL, recommandé).
federation.guide.technical =
# Lien des tutoriels web de la fédération (type URL, recommandé).
federation.guide.technical =
# Date de naissance de la fédération (type DATE (AAAA-MM-JJ ou JJ/MM/AAAA), recommandé).
federation.startdate =
# [Subs]
# Un lien vers un fichier properties complémentaire (type URL, optionnel)
# Une clé (nomination libre) pour chacune de vos organisations,
# par exemple : subs.monchaton = https://www.monchaton.ext/.well-known/monchaton.properties
subs.01 =
# [Metrics]

View file

@ -1,136 +0,0 @@
# membres.properties
# [File]
# Classe du fichier (valeur parmi {Federation, Organization, Service, Device}, obligatoire).
file.class = organization
# Version de l'ontologie utilisée utilisé (type STRING, recommandé, ex. ChatonsInfos-0.1).
file.protocol = ChatonsInfos-0.5
# Date et horaire de génération du fichier (type DATETIME, recommandé, ex. 2020-07-06T14:23:20).
file.datetime =
# Nom du générateur du fichier (type STRING, recommandé, ex. Christian avec ses doigts).
file.generator =
# [Organisation]
# Nom de l'organisation (type STRING, obligatoire, ex. LibreServiceEU).
organization.name =
# Description de l'organisation (type STRING, recommandé, ex. LibreServiceEU est le chaton de Devinsy).
organization.description =
# Type d'organisation (un parmi {ASSOCIATION, INFORMAL, COOPERATIVE, MICROCOMPANY, COMPANY, INDIVIDUAL, OTHER}, obligatoire).
organization.type =
# Lien du site web de l'organisation (type URL, recommandé, ex. https://www.libre-service.eu/).
organization.website =
# Lien du logo de l'organisation (type URL, recommandé, ex. https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu-logo-carre.svg).
organization.logo =
# Liens vers les comptes réseaux sociaux de l'organisation (type URL, optionnel).
# Liste non exhaustive à laquelle vous pouvez ajouter d'autres services.
organization.socialnetworks.diaspora =
organization.socialnetworks.facebook =
organization.socialnetworks.funkwhale =
organization.socialnetworks.mastodon =
organization.socialnetworks.pleroma =
organization.socialnetworks.mobilizon =
organization.socialnetworks.peertube =
organization.socialnetworks.pixelfeld =
organization.socialnetworks.twitter =
# Adresse vers les salons/équipes de discussion publics de l'organisation (type STRING, optionnel).
# Liste non exhaustive à laquelle vous pouvez ajouter d'autres services.
organization.chatrooms.xmpp =
organization.chatrooms.irc =
organization.chatrooms.matrix =
organization.chatrooms.rocketchat =
organization.chatrooms.mattermost =
# Nom du propriétaire de l'organisation (type STRING, optionnel, ex. Devinsy).
organization.owner.name =
# Lien du site web du propriétaire de l'organisation (type URL, optionnel, ex. https://www.devinsy.fr/).
organization.owner.website =
# Lien du logo du propriétaire de l'organisation (type URL, optionnel, ex. https://www.devinsy.fr/logo_devinsy.svg).
organization.owner.logo =
# Lien de la page web de contact de l'organisation (type URL, recommandé, ex. https://www.libre-service.eu/contact.html).
organization.contact.url =
# Courriel de contact de l'organisation (type EMAIL, recommandé, ex. contact@libre-service.eu).
organization.contact.email =
# Lien de la page des mentions légales de l'organisation (type URL, recommandé, ex. https://www.libre-service.eu/mentions_legales.html).
organization.legal.url =
# Lien de la documentation technique de l'organisation (type URL, recommandé, ex. https://forge.devinsy.fr/libre-service.eu/documentation).
organization.guide.technical =
# Lien de la documentation utilisateur de l'organisation (type URL, recommandé, ex. https://www.libre-service.eu/services.xhtml).
organization.guide.user =
# Statut de l'organisation (un parmi {ACTIVE, IDLE, AWAY}, obligatoire).
organization.status.level =
# Description du statut de l'organisation (type STRING, optionnel, ex. en sommeil).
organization.status.description =
# Date de création de l'organisation (type DATE, recommandé, ex. 08/11/2018).
organization.startdate =
# Date de fermeture de l'organisation (type DATE, optionnel, ex. 22/02/2022).
organization.enddate =
# Date d'entrée dans le collectif (type DATE, obligatoire, ex. 08/11/2018).
organization.memberof.chatons.startdate =
# Date de sortie du collectif (type DATE, optionnel, ex. 08/11/2019).
organization.memberof.chatons.enddate =
# Statut en tant que membre de l'organisation (un parmi {ACTIVE, IDLE, AWAY}, obligatoire).
organization.memberof.chatons.status.level =
# Description du statut en tant que membre de l'organisation (type STRING, optionnel, ex. en sommeil).
organization.memberof.chatons.status.description =
# Pays de l'organisation (type STRING, recommandé, ex. France).
organization.country.name =
# Code pays de l'organisation (type COUNTRY_CODE sur 2 caractères, obligatoire, ex.ex. FR ou BE ou CH ou DE ou GB).
# Table ISO 3166-1 alpha-2 : https://fr.wikipedia.org/wiki/ISO_3166-1#Table_de_codage
organization.country.code =
# Géolocalisation de l'organisation
# Coordonnées GPS
# Latitude (type DECIMAL_DEGREE, recommandé, format DD, ex. 15,23456).
organization.geolocation.latitude =
# Longitude (type DECIMAL_DEGREE, recommandé, format DD, ex. -30,67890).
organization.geolocation.longitude =
# Adresse (type STRING, recommandé, ex. 1 rue croquette, 92370 Chaville).
organization.geolocation.address =
# Liens vers les services de paiement permettant de récolter des donations pour votre chaton (type URL, optionnel).
# Dans le cas d'une solution maison (exemple : pont vers votre banque), choisir "organization.funding.custom".
# Liste non exhaustive à laquelle vous pouvez ajouter d'autres services.
organization.funding.liberapay =
organization.funding.tipee =
organization.funding.helloasso =
organization.funding.paypal =
organization.funding.custom =
# [Subs]
# Un lien vers un fichier properties complémentaire (type URL, optionnel)
# Une clé (nomination libre) pour chacun de vos services,
# par exemple pour un service etherpad : subs.etherpad = https://www.monchaton.ext/.well-known/etherpad.properties
subs.foo1 =
# [Metrics]

View file

@ -1,163 +0,0 @@
# service.properties
#WARNING : cette fiche service ne concerne que les services logiciels
# [File]
# Classe du fichier (valeur parmi {Federation, Organization, Service, Device}, obligatoire).
file.class = service
# Version de l'ontologie utilisée utilisé (type STRING, recommandé).
file.protocol = ChatonsInfos-0.5
# Date et horaire de génération du fichier (type DATETIME, recommandé, ex. 2020-07-06T14:23:20).
file.datetime =
# Nom du générateur du fichier (type STRING, recommandé).
file.generator =
# [Service]
# Nom du service (type STRING, obligatoire).
service.name =
# Description du service (type STRING, recommandé).
service.description =
# Lien du site web du service (type URL, obligatoire - si pas possible, merci de créer une page de présentation du service).
service.website =
# Lien du logo du service (type URL, recommandé, ex. https://www.libre-service.eu/.well-known/statoolinfos/logo.svg).
service.logo =
# Lien de la page web des mentions légales du service (type URL, recommandé).
service.legal.url =
# Lien de la documentation web du service (type URL, recommandé).
service.guide.technical =
# Lien des aides web pour le service (type URL, recommandé).
service.guide.user =
# Lien de la page de support du service (type URL, recommandé).
service.contact.url =
# Courriel du support du service (type EMAIL, recommandé).
service.contact.email =
# Date d'ouverture du service (type DATE, obligatoire, ex. 22/02/2022).
service.startdate =
# Date de fermeture du service (type DATE, optionnel, ex. 22/02/2022).
service.enddate =
# Statut du service (un parmi {OK, WARNING, ALERT, ERROR, OVER, VOID}, obligatoire).
# OK : tout va bien (service en fonctionnement nominal).
# WARNING : attention (service potentiellement incomplet, maintenance prévue, etc.).
# ALERT : alerte (le service connait des dysfonctionnements, le service va bientôt fermer, etc.).
# ERROR : problème majeur (service en panne).
# OVER : terminé (le service n'existe plus).
# VOID : indéterminé (service non ouvert officiellement, configuration ChatonsInfos en cours, etc.).
service.status.level =
# Description du statut du service (type STRING, optionnel, ex. mise à jour en cours)
service.status.description =
# Inscriptions requises pour utiliser le service (un ou plusieurs parmi {None, Free, Member, Client}, obligatoire, ex. Free,Member).
# None : le service s'utilise sans inscription.
# Free : inscription ouverte à tout le monde et gratuite.
# Member : inscription restreinte aux membres (la notion de membre pouvant être très relative, par exemple, une famille, un cercle damis, adhérents d'association…).
# Client : inscription liée à une relation commerciale (facture…).
service.registration =
# Capacité à accueillir de nouveaux utilisateurs (un parmi {OPEN, FULL}, obligatoire).
# OPEN : le service accueille de nouveaux comptes.
# FULL : le service n'accueille plus de nouveau compte pour l'instant.
service.registration.load =
# Type d'installation du service, une valeur parmi {DISTRIBUTION, PROVIDER, PACKAGE, TOOLING, CLONEREPO, ARCHIVE, SOURCES, CONTAINER}, obligatoire.
# DISTRIBUTION : installation via le gestionnaire d'une distribution (apt, yum, etc.).
# PROVIDER : installation via le gestionnaire d'une distribution configuré avec une source externe (ex. /etc/apt/source.list.d/foo.list).
# PACKAGE : installation manuelle d'un paquet compatible distribution (ex. dpkg -i foo.deb).
# TOOLING : installation via un gestionnaire de paquets spécifique, différent de celui de la distribution (ex. pip…).
# CLONEREPO : clone manuel d'un dépôt (git clone…).
# ARCHIVE : application récupérée dans un tgz ou un zip ou un bzip2…
# SOURCES : compilation manuelle à partir des sources de l'application.
# CONTAINER : installation par containeur (Docker, Snap, Flatpak, etc.).
# L'installation d'un service via un paquet Snap avec apt sous Ubuntu doit être renseigné CONTAINER.
# L'installation d'une application ArchLinux doit être renseignée DISTRIBUTION.
# L'installation d'une application Yunohost doit être renseignée DISTRIBUTION.
service.install.type =
# [Software]
# Nom du logiciel (type STRING, obligatoire).
software.name =
# Lien du site web du logiciel (type URL, recommandé).
software.website =
# Lien web vers la licence du logiciel (type URL, obligatoire).
software.license.url =
# Nom de la licence du logiciel (type STRING, obligatoire).
software.license.name =
# Version du logiciel (type STRING, recommandé).
software.version =
# Lien web vers les sources du logiciel (type URL, recommandé).
software.source.url =
# Liste de modules optionnels installés (type VALUES, optionnel, ex. Nextcloud-Calendar,Nextcloud-Talk).
software.modules =
# [Host]
# Nom de l'hébergeur de la machine qui fait tourner le service, dans le cas d'un auto-hébergement c'est vous ! (type STRING, obligatoire).
host.name =
# Description de l'hébergeur (type STRING, optionnel).
host.description =
# Nom générique de la distribution installée sur le serveur (type STRING, obligatoire, ex. YunoHost).
host.server.distribution =
# Type de serveur (un parmi {NANO, PHYSICAL, VIRTUAL, SHARED, CLOUD}, obligatoire, ex. PHYSICAL).
# NANO : nano-ordinateur (Raspberry Pi, Olimex…)
# PHYSICAL : machine physique
# VIRTUAL : machine virtuelle
# SHARED : hébergement mutualisé
# CLOUD : infrastructure multi-serveurs
host.server.type =
# Type d'hébergement (un parmi {HOME, HOSTEDBAY, HOSTEDSERVER, OUTSOURCED}, obligatoire, ex. HOSTEDSERVER).
# HOME : hébergement à domicile
# HOSTEDBAY : serveur personnel hébergé dans une baie d'un fournisseur
# HOSTEDSERVER : serveur d'un fournisseur
# OUTSOURCED : infrastructure totalement sous-traitée
host.provider.type =
# Si vous avez du mal à remplir les champs précédents, ce tableau pourra vous aider :
# NANO PHYSICAL VIRTUAL SHARED CLOUD
# HOME pm pm vm shared cloud
# HOSTEDBAY pm pm vm shared cloud
# HOSTEDSERVER -- pm vm shared cloud
# OUTSOURCED -- -- vps shared cloud
# Légendes : pm : physical machine ; vm : virtual machine ; vps : virtual private server.
# Nom du logiciel hyperviseur (type STRING, optionnel, ex. KVM).
host.provider.hypervisor =
# Pays de l'hébergeur (type STRING, recommandé).
host.country.name =
# Code pays de l'hébergeur (type COUNTRY_CODE sur 2 caractères, obligatoire, ex. FR ou BE ou CH ou DE ou GB).
# Table ISO 3166-1 alpha-2 : https://fr.wikipedia.org/wiki/ISO_3166-1#Table_de_codage
host.country.code =
# [Subs]
# Un lien vers un fichier properties complémentaire (type URL, optionnel).
# Une clé (nomination libre) pour chacun de vos métriques spécifiques,
# par exemple pour un service etherpad : subs.metrics-etherpad = https://www.monchaton.ext/.well-known/metrics-etherpad.properties
subs.foo =

View file

@ -1,43 +0,0 @@
# File + organization + services + machines + metrics
# [File]
file.class=organization
file.generator=Cpm
file.datetime=2022-07-22T17:35:58
file.protocol=StatoolInfos-0.5
# [Organization]
organization.name=Services au public
organization.description=Les services publics de Libre-service.eu
organization.website=https://www.libre-service.eu/
organization.logo=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu-logo-public.png
organization.status.level=ACTIVE
organization.status.description=En activité
organization.owner.name=Libre-service.eu
organization.owner.website=https://www.libre-service.eu/
organization.owner.logo=https://www.libre-service.eu/.well-known/statoolinfos/libre-service.eu-logo-carre.png
organization.contact.url=https://www.libre-service.eu/contact.xhtml
organization.contact.email=contact@libre-service.eu
organization.socialnetworks.mastodon=
organization.legal.url=https://www.libre-service.eu/mentions-legales.xhtml
organization.guide.user=https://www.libre-service.eu/
organization.guide.technical=https://forge.devinsy.fr/libre-service.eu/documentation
organization.startdate=01/10/2021
organization.enddate=
organization.memberof.libreserviceeu.status.level=ACTIVE
organization.memberof.libreserviceeu.status.description=
organization.memberof.libreserviceeu.startdate=01/10/2021
organization.memberof.libreserviceeu.enddate=
organization.country.name=France
organization.country.code=FR
organization.type=INFORMAL
# [Subs]
subs.audio=https://audio.libre-service.eu/.well-known/statoolinfos/audio.libre-service.eu.properties
subs.minetest=https://minetest.libre-service.eu/.well-known/statoolinfos/minetest.libre-service.eu.properties
subs.pad=https://pad.libre-service.eu/.well-known/statoolinfos/pad.libre-service.eu.properties
subs.paste=https://paste.libre-service.eu/.well-known/statoolinfos/paste.libre-service.eu.properties
subs.qrcode=https://qrcode.libre-service.eu/.well-known/statoolinfos/qrcode.libre-service.eu.properties
subs.visio=https://visio.libre-service.eu/.well-known/statoolinfos/visio.libre-service.eu.properties
# [Metrics]

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -16,25 +16,31 @@
* You should have received a copy of the GNU Affero General Public License
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.core;
package fr.devinsy.statoolinfos;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import fr.devinsy.statoolinfos.core.Categories;
import fr.devinsy.statoolinfos.core.Configuration;
import fr.devinsy.statoolinfos.core.Factory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
/**
* The Class StatoolInfosContext.
* The Class Manager.
*/
public class StatoolInfosContext
public class HtmlizerContext
{
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StatoolInfosContext.class);
private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(HtmlizerContext.class);
private static class SingletonHolder
{
private static final HtmlizerContext instance = new HtmlizerContext();
}
private LocalDateTime initDateTime;
private Configuration configuration;
private Federation federation;
private Categories categories;
@ -42,18 +48,10 @@ public class StatoolInfosContext
private UptimeJournal uptimeJournal;
/**
* Instantiates a new statool infos context.
*
* @param configurationFile
* the configuration file
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
* Instantiates a new manager.
*/
public StatoolInfosContext(final File configurationFile) throws StatoolInfosException, IOException
private HtmlizerContext()
{
configure(configurationFile);
}
/**
@ -61,41 +59,44 @@ public class StatoolInfosContext
*
* @param configurationFile
* the configuration file
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws StatoolInfosException
*/
public void configure(final File configurationFile) throws StatoolInfosException, IOException
{
this.configuration = Factory.loadConfiguration(configurationFile);
logger.info("Cache setting: {}", this.configuration.getCrawlCachePath());
logger.info("Cache input setting: {}", this.configuration.getCrawlInputURL());
logger.info("Htmlize input setting: {}", this.configuration.getHtmlizeInputURL());
logger.info("Htmlize directory setting: {}", this.configuration.getHtmlizeDirectoryPath());
this.cache = new CrawlCache(this.configuration.getCrawlCacheDirectory());
if (this.configuration.isFederation())
File htmlizeDirectory = this.configuration.getHtmlizeDirectory();
if (htmlizeDirectory == null)
{
long startTime = System.currentTimeMillis();
System.out.println("Loading configuration file.");
this.federation = Factory.loadFederation(this.configuration.getCrawlInputURL(), this.cache);
if (this.configuration.isCategoryFileDefined())
{
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
}
else
{
URL categoriesURL = StatoolInfosContext.class.getResource("/fr/devinsy/statoolinfos/core/categories.properties");
this.categories = Factory.loadCategories(categoriesURL, this.federation);
}
this.uptimeJournal = this.cache.restoreUptimeJournal();
this.initDateTime = LocalDateTime.now();
System.out.println("Loaded configuration context in " + (System.currentTimeMillis() - startTime) + " ms.");
throw new IllegalArgumentException("Htmlize directory undefined.");
}
else if (!htmlizeDirectory.exists())
{
throw new IllegalArgumentException("Htmlize directory is missing.");
}
else if (!htmlizeDirectory.isDirectory())
{
throw new IllegalArgumentException("Htmlize directory is not a directory.");
}
else
{
throw new IllegalArgumentException("Not a federation configuration.");
if (this.configuration.isFederation())
{
this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache);
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
this.uptimeJournal = this.cache.restoreUptimeJournal();
}
else
{
throw new IllegalArgumentException("Not a federation configuration.");
}
}
}
@ -160,39 +161,32 @@ public class StatoolInfosContext
}
/**
* Gets the uptime journal.
* Htmlize directory.
*
* @return the uptime journal
* @return the file
*/
public File getHtmlizeDirectory()
{
File result;
result = this.configuration.getHtmlizeDirectory();
//
return result;
}
public UptimeJournal getUptimeJournal()
{
return this.uptimeJournal;
}
/**
* Checks if is expired.
* Instance.
*
* @return true, if is expired
* @return the manager
*/
public boolean isExpired()
public static HtmlizerContext instance()
{
boolean result;
getCache();
long cacheTime = this.getCache().getDirectory().lastModified();
LocalDateTime cacheDateTime = LocalDateTime.ofEpochSecond(cacheTime / 1000, 0, OffsetDateTime.now().getOffset());
if (cacheDateTime.isAfter(this.initDateTime))
{
result = true;
}
else
{
result = false;
}
//
return result;
return SingletonHolder.instance;
}
}

View file

@ -72,8 +72,8 @@ public final class StatoolInfosLauncher
else
{
//
Level logEnvLevel = Level.getLevel(StringUtils.defaultString(System.getenv().get("LOG4J_LEVEL"), " "));
Level logPropertyLevel = Level.getLevel(StringUtils.defaultString(System.getProperty("log4j2.level", " ")));
Level logEnvLevel = Level.getLevel(StringUtils.defaultString(System.getenv().get("LOG4J_LEVEL"), ""));
Level logPropertyLevel = Level.getLevel(StringUtils.defaultString(System.getProperty("log4j2.level", "")));
Level level;
if (logPropertyLevel != null)

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -80,106 +80,51 @@ public class PropertyCheck
this.comment = comment;
}
/**
* Gets the comment.
*
* @return the comment
*/
public String getComment()
{
return this.comment;
}
/**
* Gets the file name.
*
* @return the file name
*/
public String getFileName()
{
return this.fileName;
}
/**
* Gets the index.
*
* @return the index
*/
public long getIndex()
{
return this.index;
}
/**
* Gets the line.
*
* @return the line
*/
public String getLine()
{
return this.line;
}
/**
* Gets the status.
*
* @return the status
*/
public Status getStatus()
{
return this.status;
}
/**
* Sets the comment.
*
* @param comment
* the new comment
*/
public void setComment(final String comment)
{
this.comment = comment;
}
/**
* Sets the file name.
*
* @param fileName
* the new file name
*/
public void setFileName(final String fileName)
{
this.fileName = fileName;
}
/**
* Sets the index.
*
* @param index
* the new index
*/
public void setIndex(final long index)
{
this.index = index;
}
/**
* Sets the line.
*
* @param line
* the new line
*/
public void setLine(final String line)
{
this.line = line;
}
/**
* Sets the status.
*
* @param status
* the new status
*/
public void setStatus(final Status status)
{
this.status = status;

View file

@ -293,12 +293,12 @@ public class PropertyChecker
check = new PropertyCheck(lineIndex, "", Status.OK);
check.setComment("OK");
}
else if ((StringUtils.isEmpty(line)) || (isComment(line)))
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
{
check = new PropertyCheck(lineIndex, line, Status.OK);
check.setComment("OK");
}
else if (!isProperty(line))
else if (!line.matches("^[^#].*[^\\s].*=.*$"))
{
check = new PropertyCheck(lineIndex, line, Status.ERROR);
check.setComment("Ligne malformée");
@ -458,83 +458,4 @@ public class PropertyChecker
//
return result;
}
/**
* Checks if is comment.
*
* @param line
* the line
* @return true, if is comment
*/
public static boolean isComment(final String line)
{
boolean result;
// Method 1
// public static final Pattern COMMENT_PATTERN =
// Pattern.compile(COMMENT);
// result = COMMENT_PATTERN.matcher(line).matches();
// Method 2
// result = StringUtils.startsWith(line, "#");
// Method 3
if ((line != null) && (line.length() > 0) && (line.charAt(0) == '#'))
{
result = true;
}
else
{
result = false;
}
//
return result;
}
/**
* Checks if is property.
*
* @param line
* the line
* @return true, if is property
*/
public static boolean isProperty(final String line)
{
boolean result;
// Method 1, take so much time, > 1000 ms for each property file.
// public static final Pattern PROPERTY_PATTERN =
// Pattern.compile("^[^#].*[^\\s].*=.*$");
// result = PROPERTY_PATTERN.matcher(line).matches();
// Method 2, well optimized, < 1 ms for each property file.
if ((line == null) || (line.length() == 0))
{
result = false;
}
else
{
int splitter = line.indexOf('=');
if (splitter == -1)
{
result = false;
}
else
{
String path = line.substring(0, splitter);
if ((path.length() == 0) || (path.charAt(0) == '#') || (StringUtils.isBlank(path)))
{
result = false;
}
else
{
result = true;
}
}
}
//
return result;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -76,11 +76,8 @@ public class PropertyRule
}
/**
* Check path.
*
* @param value
* the value
* @return true, if successful
* @return
*/
public boolean checkPath(final String value)
{
@ -111,21 +108,11 @@ public class PropertyRule
return result;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel()
{
return this.label;
}
/**
* Gets the mode.
*
* @return the mode
*/
public PropertyMode getMode()
{
return this.mode;
@ -227,12 +214,6 @@ public class PropertyRule
return result;
}
/**
* Sets the mode.
*
* @param mode
* the new mode
*/
public void setMode(final PropertyMode mode)
{
this.mode = mode;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -19,12 +19,16 @@
package fr.devinsy.statoolinfos.cli;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class CLIUtils.
*/
public final class CLIUtils
{
private static Logger logger = LoggerFactory.getLogger(CLIUtils.class);
/**
* Instantiates a new statool infos CLI.
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -26,8 +26,8 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.app.StatoolInfosApp;
import fr.devinsy.statoolinfos.core.BotFilter;
import fr.devinsy.statoolinfos.core.StatoolInfos;
import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.statoolinfos.util.Chrono;
import fr.devinsy.statoolinfos.util.Files;
@ -110,7 +110,7 @@ public final class StatoolInfosCLI
message.appendln(" statoolinfos clear <configurationfile> remove property files from conf");
message.appendln(" statoolinfos crawl <configurationfile> crawl all file from conf and input");
message.appendln(" statoolinfos format <fileordirectory> format property files in tiny way");
message.appendln(" s̶t̶a̶t̶o̶o̶l̶i̶n̶f̶o̶s̶ ̶h̶t̶m̶l̶i̶z̶e̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶ ̶<̶c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶f̶i̶l̶e̶> REMOVED since splitweb");
message.appendln(" statoolinfos htmlize <configurationfile> generate web pages from conf");
message.appendln(" statoolinfos probe OPTION [<directory>|<configurationfile>] generate metrics files from conf");
message.appendln(" OPTION = [-full|-today|-previousday|-NN] with NN a day count");
message.appendln(" statoolinfos tagdate <fileordirectory> update the file.datetime file");
@ -118,14 +118,12 @@ public final class StatoolInfosCLI
message.appendln();
message.appendln(" statoolinfos list file <logfilesorconfigfile> display http access log files");
message.appendln(" statoolinfos list log [-bot|-nobot] <logfilesorconfigfile> display http access log lines");
message.appendln(" statoolinfos list ip [-bot|-nobot] <logfilesorconfigfile> generate ip list from http log file");
message.appendln(" statoolinfos list ua [-bot|-nobot] <logfilesorconfigfile> generate user agent list from http log file");
message.appendln(" statoolinfos list visitor [-bot|-nobot] <logfilesorconfigfile> generate visitors (ip+ua) list from http log file");
message.appendln(" statoolinfos stat ip [-bot|-nobot] <logfilesorconfigfile> generate stats about ip from http log file");
message.appendln(" statoolinfos stat ua [-bot|-nobot] <logfilesorconfigfile> generate stats about user agent from http log file");
message.appendln(" statoolinfos stat visitor [-bot|-nobot] <logfilesorconfigfile> generate stats about visitor (ip+ua) from http log file");
message.appendln(" statoolinfos list errfile <logfilesorconfigfile> display http error log files");
message.appendln(" statoolinfos list errlog <logfilesorconfigfile> display http error log lines");
message.appendln(" statoolinfos list ip [-bot|-nobot] <logfiles> generate ip list from http log file");
message.appendln(" statoolinfos list ua [-bot|-nobot] <logfiles> generate user agent list from http log file");
message.appendln(" statoolinfos list visitor [-bot|-nobot] <logfiles> generate visitors (ip+ua) list from http log file");
message.appendln(" statoolinfos stat ip [-bot|-nobot] <logfiles> generate stats about ip from http log file");
message.appendln(" statoolinfos stat ua [-bot|-nobot] <logfiles> generate stats about user agent from http log file");
message.appendln(" statoolinfos stat visitor [-bot|-nobot] <logfiles> generate stats about visitor (ip+ua) from http log file");
System.out.print(message.toString());
}
@ -249,7 +247,7 @@ public final class StatoolInfosCLI
File configurationFile = new File(StringUtils.trim(args[1]));
try
{
StatoolInfosApp.build(configurationFile);
StatoolInfos.build(configurationFile);
}
catch (Exception exception)
{
@ -261,7 +259,7 @@ public final class StatoolInfosCLI
File configurationFile = new File(StringUtils.trim(args[1]));
try
{
StatoolInfosApp.clear(configurationFile);
StatoolInfos.clear(configurationFile);
}
catch (Exception exception)
{
@ -275,7 +273,7 @@ public final class StatoolInfosCLI
File configurationFile = new File(StringUtils.trim(args[1]));
try
{
StatoolInfosApp.crawl(configurationFile);
StatoolInfos.crawl(configurationFile);
}
catch (Exception exception)
{
@ -291,7 +289,7 @@ public final class StatoolInfosCLI
{
try
{
StatoolInfosApp.format(input);
StatoolInfos.format(input);
}
catch (Exception exception)
{
@ -300,18 +298,20 @@ public final class StatoolInfosCLI
}
}
}
else if (CLIUtils.isMatching(args, "list", "ip", "(-all|-bot|-nobot)", ".+\\.conf*"))
else if (CLIUtils.isMatching(args, "htmlize", ".+\\.conf"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.listIps(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "list", "ip", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listIps(configurationFile, BotFilter.ALL);
Chrono chrono = new Chrono().start();
File configurationFile = new File(StringUtils.trim(args[1]));
try
{
StatoolInfos.htmlize(configurationFile);
}
catch (Exception exception)
{
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
exception.printStackTrace();
}
System.out.println(chrono.format());
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", "(-all|-bot|-nobot)", ".+"))
{
@ -322,7 +322,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listIps(source, filter);
StatoolInfos.listIps(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", ".+"))
{
@ -332,13 +332,13 @@ public final class StatoolInfosCLI
files.add(new File(args[source]));
}
StatoolInfosApp.listIps(files, BotFilter.ALL);
StatoolInfos.listIps(files, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "list", "(file|files)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listAccessFiles(configurationFile);
StatoolInfos.listFiles(configurationFile);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(file|files)", ".+"))
{
@ -348,36 +348,20 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listAccessFiles(source);
}
else if (CLIUtils.isMatching(args, "list", "(errfile|errfiles)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listErrorFiles(configurationFile);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(errfile|errfiles)", ".+"))
{
Files source = new Files();
for (int index = 2; index < args.length; index++)
{
source.add(new File(args[index]));
}
StatoolInfosApp.listErrorFiles(source);
StatoolInfos.listFiles(source);
}
else if (CLIUtils.isMatching(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.listLogs(configurationFile, filter);
StatoolInfos.listLogs(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "list", "(log|logs)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listLogs(configurationFile, BotFilter.ALL);
StatoolInfos.listLogs(configurationFile, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+"))
{
@ -388,7 +372,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listLogs(source, filter);
StatoolInfos.listLogs(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", ".+"))
{
@ -398,36 +382,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listLogs(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "list", "(errlog|errlogs)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listErrorLogs(configurationFile);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(errlog|errlogs)", ".+"))
{
Files source = new Files();
for (int index = 2; index < args.length; index++)
{
source.add(new File(args[index]));
}
StatoolInfosApp.listErrorLogs(source);
}
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.listUserAgents(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listUserAgents(configurationFile, BotFilter.ALL);
StatoolInfos.listLogs(source, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
{
@ -438,7 +393,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listUserAgents(source, filter);
StatoolInfos.listUserAgents(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", ".+"))
{
@ -448,20 +403,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listUserAgents(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "list", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.listVisitors(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "list", "(visitor|visitors)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.listVisitors(configurationFile, BotFilter.ALL);
StatoolInfos.listUserAgents(source, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
{
@ -472,7 +414,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listVisitors(source, filter);
StatoolInfos.listVisitors(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", ".+"))
{
@ -482,7 +424,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.listVisitors(source, BotFilter.ALL);
StatoolInfos.listVisitors(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "probe", "(-full|-today|-previousday|-\\d+)", ".+"))
{
@ -521,7 +463,7 @@ public final class StatoolInfosCLI
try
{
System.out.println("Probing [" + input + "] with day count filter " + dayCountFilter);
StatoolInfosApp.probe(input, dayCountFilter);
StatoolInfos.probe(input, dayCountFilter);
}
catch (Exception exception)
{
@ -537,19 +479,6 @@ public final class StatoolInfosCLI
exception.printStackTrace();
}
}
else if (CLIUtils.isMatching(args, "stat", "ip", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.statIps(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "stat", "ip", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.statIps(configurationFile, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", "(-all|-bot|-nobot)", ".+"))
{
BotFilter filter = parseLogFilterOption(args[2]);
@ -559,7 +488,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statIps(source, filter);
StatoolInfos.statIps(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", ".+"))
{
@ -569,20 +498,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statIps(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.statUserAgents(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.statUserAgents(configurationFile, BotFilter.ALL);
StatoolInfos.statIps(source, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
{
@ -593,7 +509,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statUserAgents(source, filter);
StatoolInfos.statUserAgents(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", ".+"))
{
@ -603,20 +519,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statUserAgents(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "stat", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+\\.conf*"))
{
BotFilter filter = parseLogFilterOption(args[2]);
File configurationFile = new File(StringUtils.trim(args[3]));
StatoolInfosApp.statVisitors(configurationFile, filter);
}
else if (CLIUtils.isMatching(args, "stat", "(visitor|visitors)", ".+\\.conf"))
{
File configurationFile = new File(StringUtils.trim(args[2]));
StatoolInfosApp.statVisitors(configurationFile, BotFilter.ALL);
StatoolInfos.statUserAgents(source, BotFilter.ALL);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
{
@ -627,7 +530,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statVisitors(source, filter);
StatoolInfos.statVisitors(source, filter);
}
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", ".+"))
{
@ -637,7 +540,7 @@ public final class StatoolInfosCLI
source.add(new File(args[index]));
}
StatoolInfosApp.statVisitors(source, BotFilter.ALL);
StatoolInfos.statVisitors(source, BotFilter.ALL);
}
else if (CLIUtils.isMatching(args, "tagdate", ".+"))
{
@ -646,7 +549,7 @@ public final class StatoolInfosCLI
{
try
{
StatoolInfosApp.tagDate(input);
StatoolInfos.tagDate(input);
}
catch (Exception exception)
{
@ -662,7 +565,7 @@ public final class StatoolInfosCLI
File configurationFile = new File(StringUtils.trim(args[1]));
try
{
StatoolInfosApp.uptime(configurationFile);
StatoolInfos.uptime(configurationFile);
}
catch (Exception exception)
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -18,7 +18,7 @@
*/
package fr.devinsy.statoolinfos.core;
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLog;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLog;
/**
* The Enum LogFilter.

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -22,8 +22,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.strings.StringList;
/**
@ -66,43 +64,6 @@ public class Categories extends ArrayList<Category>
return result;
}
/**
* Gets the by technical name.
*
* @param technicalName
* the technical name
* @return the by technical name
*/
public Category getByTechnicalName(final String technicalName)
{
Category result;
Iterator<Category> iterator = this.iterator();
boolean ended = false;
result = null;
while (!ended)
{
if (iterator.hasNext())
{
Category category = iterator.next();
if (StringUtils.equals(category.getTechnicalName(), technicalName))
{
ended = true;
result = category;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Matches.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -29,25 +29,22 @@ import fr.devinsy.strings.StringList;
*/
public class Category
{
public static final String DEFAULT_LOGO_PATH = "default.svg";
public static final String DEFAULT_LOGO_PATH = "categories/default.svg";
private String name;
private String technicalName;
private String description;
private StringList softwares;
private String logoPath;
/**
* Instantiates a new category.
*
* @param name
* the name
* @param description
* the description
*/
public Category(final String name, final String description)
{
this(name, description, null);
this.name = name;
this.description = description;
this.softwares = new StringList();
this.logoPath = DEFAULT_LOGO_PATH;
}
/**
@ -63,17 +60,11 @@ public class Category
public Category(final String name, final String description, final StringList softwares)
{
this.name = name;
this.technicalName = StatoolInfosUtils.toTechnicalName(getName());
this.description = description;
this.softwares = new StringList(softwares);
this.logoPath = DEFAULT_LOGO_PATH;
}
/**
* Gets the description.
*
* @return the description
*/
public String getDescription()
{
return this.description;
@ -101,21 +92,11 @@ public class Category
return result;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
return this.name;
}
/**
* Gets the softwares.
*
* @return the softwares
*/
public StringList getSoftwares()
{
return this.softwares;
@ -130,7 +111,7 @@ public class Category
{
String result;
result = this.technicalName;
result = StatoolInfosUtils.toTechnicalName(getName());
//
return result;
@ -193,12 +174,6 @@ public class Category
return result;
}
/**
* Sets the description.
*
* @param description
* the new description
*/
public void setDescription(final String description)
{
this.description = description;
@ -218,16 +193,10 @@ public class Category
}
else
{
this.logoPath = logoPath;
this.logoPath = "categories/" + logoPath;
}
}
/**
* Sets the name.
*
* @param name
* the new name
*/
public void setName(final String name)
{
this.name = name;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -25,7 +25,6 @@ import java.net.URL;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathProperty;
import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.strings.StringList;
@ -55,23 +54,6 @@ public class Configuration extends PathPropertyList
super(properties);
}
/**
* Adds the.
*
* @param path
* the path
* @param value
* the value
*/
public void add(final String path, final String value)
{
if (!StringUtils.isBlank(path))
{
PathProperty property = new PathProperty(path, value);
this.add(property);
}
}
/**
* Gets the builds the directory.
*
@ -167,10 +149,10 @@ public class Configuration extends PathPropertyList
{
File result;
String path = get("conf.categories");
String path = get("conf.htmlize.categories");
if (StringUtils.isBlank(path))
{
result = null;
throw new StatoolInfosException("Entry conf.htmlize.categories is missing in configuration file.");
}
else
{
@ -318,15 +300,55 @@ public class Configuration extends PathPropertyList
}
/**
* Gets the probe http access log date pattern.
* Gets the htmlize directory.
*
* @return the probe http access log date pattern
* @return the htmlize directory
*/
public String getProbeHttpAccessLogDateTimePattern()
public File getHtmlizeDirectory()
{
File result;
String path = getHtmlizeDirectoryPath();
if (StringUtils.isBlank(path))
{
result = null;
}
else
{
result = new File(path);
}
//
return result;
}
/**
* Gets the htmlize directory path.
*
* @return the htmlize directory path
*/
public String getHtmlizeDirectoryPath()
{
String result;
result = get("conf.probe.httpaccesslog.datetimepattern");
result = get("conf.htmlize.directory");
//
return result;
}
/**
* Gets the htmlize input URL.
*
* @return the htmlize input URL
* @throws MalformedURLException
* the malformed URL exception
*/
public URL getHtmlizeInputURL() throws MalformedURLException
{
URL result;
result = new URL(get("conf.htmlize.input"));
//
return result;
@ -406,36 +428,6 @@ public class Configuration extends PathPropertyList
return result;
}
/**
* Gets the probe http error log date time pattern.
*
* @return the probe http error log date time pattern
*/
public String getProbeHttpErrorLogDateTimePattern()
{
String result;
result = get("conf.probe.httperrorlog.datetimepattern");
//
return result;
}
/**
* Gets the probe http error log pattern.
*
* @return the probe http error log pattern
*/
public String getProbeHttpErrorLogPattern()
{
String result;
result = get("conf.probe.httperrorlog.pattern");
//
return result;
}
/**
* Gets the probe http error log source.
*
@ -528,28 +520,6 @@ public class Configuration extends PathPropertyList
return result;
}
/**
* Checks if is category file defined.
*
* @return true, if is category file defined
*/
public boolean isCategoryFileDefined()
{
boolean result;
if (StringUtils.isBlank(get("conf.categories")))
{
result = false;
}
else
{
result = true;
}
//
return result;
}
/**
* Checks if is federation.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -35,6 +35,7 @@ import fr.devinsy.statoolinfos.properties.PathProperty;
import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
import fr.devinsy.statoolinfos.properties.PropertyClassType;
import fr.devinsy.statoolinfos.util.Chrono;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringSet;
@ -65,9 +66,33 @@ public class Factory
{
Categories result;
result = new Categories();
PathProperties properties = PathPropertyUtils.load(source);
result = loadCategories(properties);
StringSet prefixes = properties.getSubPrefixes();
for (String prefix : prefixes)
{
String name = properties.get(prefix + ".name");
String description = properties.get(prefix + ".description");
String softwares = properties.get(prefix + ".softwares");
String logoPath = properties.get(prefix + ".logo");
StringList softwareList = new StringList();
if (StringUtils.isNotBlank(softwares))
{
for (String string : softwares.split("[;,]"))
{
softwareList.add(string.trim());
}
}
Category category = new Category(name, description, softwareList);
category.setLogoPath(logoPath);
result.add(category);
}
result.sortByName();
//
return result;
@ -105,102 +130,6 @@ public class Factory
return result;
}
/**
* Load categories.
*
* @param properties
* the properties
* @return the categories
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static Categories loadCategories(final PathProperties properties) throws IOException
{
Categories result;
result = new Categories();
StringSet prefixes = properties.getSubPrefixes();
for (String prefix : prefixes)
{
String name = properties.get(prefix + ".name");
String description = properties.get(prefix + ".description");
String softwares = properties.get(prefix + ".softwares");
String logoPath = properties.get(prefix + ".logo");
StringList softwareList = new StringList();
if (StringUtils.isNotBlank(softwares))
{
for (String string : softwares.split("[;,]"))
{
softwareList.add(string.trim());
}
}
Category category = new Category(name, description, softwareList);
category.setLogoPath(logoPath);
result.add(category);
}
result.sortByName();
//
return result;
}
/**
* Load categories.
*
* @param source
* the source
* @return the categories
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static Categories loadCategories(final URL source) throws IOException
{
Categories result;
PathProperties properties = PathPropertyUtils.load(source);
result = loadCategories(properties);
//
return result;
}
/**
* Load categories.
*
* @param source
* the source
* @param federation
* the federation
* @return the categories
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static Categories loadCategories(final URL source, final Federation federation) throws IOException
{
Categories result;
result = loadCategories(source);
Category other = new Category("Autres", "Qui ne rentre pas dans une catégorie existante.");
result.add(other);
for (Software software : federation.getSoftwares().values())
{
if (!result.matches(software.getName()))
{
other.getSoftwares().add(software.getName());
}
}
//
return result;
}
/**
* Load configuration.
*
@ -209,20 +138,15 @@ public class Factory
* @return the configuration
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static Configuration loadConfiguration(final File configurationFile) throws StatoolInfosException
public static Configuration loadConfiguration(final File configurationFile) throws StatoolInfosException, IOException
{
Configuration result;
try
{
PathProperties properties = PathPropertyUtils.load(configurationFile);
result = new Configuration(properties);
}
catch (IOException exception)
{
throw new StatoolInfosException("Error reading configuration file: " + configurationFile, exception);
}
PathProperties properties = PathPropertyUtils.load(configurationFile);
result = new Configuration(properties);
//
return result;
@ -246,6 +170,7 @@ public class Factory
Federation result;
System.out.println("Loading federation " + inputURL);
Chrono chrono = new Chrono().start();
if (inputURL == null)
{
@ -276,7 +201,7 @@ public class Factory
result = new Federation(properties);
result.setInputURL(inputURL);
result.setInputFile(federationFile);
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
PropertyChecker checker = new PropertyChecker();
PropertyChecks checks = checker.checkFederation(result.getInputFile());
@ -302,6 +227,7 @@ public class Factory
result.getCrawlJournal().addAll(cache.restoreCrawlJournal());
}
}
System.out.println("Federation loaded in " + chrono.format());
//
return result;
@ -327,6 +253,7 @@ public class Factory
System.out.println("Loading metrics " + inputURL);
File inputFile = cache.restoreFile(inputURL);
if (inputFile == null)
{
logger.warn("WARNING: metrics not found in cache [{}]", inputURL);
@ -383,7 +310,7 @@ public class Factory
{
result.setInputFile(inputFile);
result.setInputURL(inputURL);
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
//
PropertyChecker checker = new PropertyChecker();
@ -429,15 +356,8 @@ public class Factory
/**
* Load service.
*
* @param inputURL
* the input URL
* @param cache
* the cache
* @param organization
* the organization
* @return the service
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static Service loadService(final URL inputURL, final CrawlCache cache, final Organization organization) throws IOException
{
@ -466,7 +386,7 @@ public class Factory
result.setOrganization(organization);
result.setInputFile(inputFile);
result.setInputURL(inputURL);
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
result.setLogoFileName(organization.getTechnicalName() + "-" + result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
//
PathProperties subs = result.getByPrefix("subs");

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -29,11 +29,11 @@ import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.checker.PropertyChecks;
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
import fr.devinsy.statoolinfos.properties.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.statoolinfos.properties.WeekValues;
import fr.devinsy.statoolinfos.properties.YearValues;
import fr.devinsy.statoolinfos.uptime.URLSet;
import fr.devinsy.statoolinfos.util.URLUtils;
@ -217,11 +217,6 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the crawl journal.
*
* @return the crawl journal
*/
public CrawlJournal getCrawlJournal()
{
return this.crawlJournal;
@ -257,11 +252,6 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the input checks.
*
* @return the input checks
*/
public PropertyChecks getInputChecks()
{
return this.inputChecks;
@ -289,21 +279,11 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the input file.
*
* @return the input file
*/
public File getInputFile()
{
return this.inputFile;
}
/**
* Gets the input URL.
*
* @return the input URL
*/
public URL getInputURL()
{
return this.inputURL;
@ -356,11 +336,6 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the logo file name.
*
* @return the logo file name
*/
public String getLogoFileName()
{
return this.logoFileName;
@ -524,11 +499,6 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the organizations.
*
* @return the organizations
*/
public Organizations getOrganizations()
{
return this.organizations;
@ -849,23 +819,11 @@ public class Federation extends PathPropertyList
this.inputFile = inputFile;
}
/**
* Sets the input URL.
*
* @param inputURL
* the new input URL
*/
public void setInputURL(final URL inputURL)
{
this.inputURL = inputURL;
}
/**
* Sets the logo file name.
*
* @param logoFileName
* the new logo file name
*/
public void setLogoFileName(final String logoFileName)
{
this.logoFileName = logoFileName;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -23,6 +23,8 @@ import java.net.URL;
import java.time.LocalDateTime;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.checker.PropertyChecks;
import fr.devinsy.statoolinfos.properties.PathProperties;
@ -35,6 +37,8 @@ public class Metrics extends PathPropertyList
{
private static final long serialVersionUID = -1608084706095266037L;
private static Logger logger = LoggerFactory.getLogger(Metrics.class);
private String localFileNamePrefix;
private File inputFile;
private URL inputURL;
@ -95,31 +99,16 @@ public class Metrics extends PathPropertyList
return result;
}
/**
* Gets the input checks.
*
* @return the input checks
*/
public PropertyChecks getInputChecks()
{
return this.inputChecks;
}
/**
* Gets the input file.
*
* @return the input file
*/
public File getInputFile()
{
return this.inputFile;
}
/**
* Gets the input URL.
*
* @return the input URL
*/
public URL getInputURL()
{
return this.inputURL;
@ -155,11 +144,6 @@ public class Metrics extends PathPropertyList
return result;
}
/**
* Gets the local file name prefix.
*
* @return the local file name prefix
*/
public String getLocalFileNamePrefix()
{
return this.localFileNamePrefix;
@ -181,34 +165,16 @@ public class Metrics extends PathPropertyList
return result;
}
/**
* Sets the input file.
*
* @param inputFile
* the new input file
*/
public void setInputFile(final File inputFile)
{
this.inputFile = inputFile;
}
/**
* Sets the input URL.
*
* @param inputURL
* the new input URL
*/
public void setInputURL(final URL inputURL)
{
this.inputURL = inputURL;
}
/**
* Sets the local file name prefix.
*
* @param localFileNamePrefix
* the new local file name prefix
*/
public void setLocalFileNamePrefix(final String localFileNamePrefix)
{
this.localFileNamePrefix = localFileNamePrefix;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -29,11 +29,11 @@ import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.checker.PropertyChecks;
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
import fr.devinsy.statoolinfos.properties.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.statoolinfos.properties.WeekValues;
import fr.devinsy.statoolinfos.properties.YearValues;
import fr.devinsy.statoolinfos.uptime.URLSet;
import fr.devinsy.statoolinfos.util.URLUtils;
@ -516,7 +516,7 @@ public class Organization extends PathPropertyList
{
LocalDate result;
result = getDate("organization.memberof." + this.federation.getTechnicalName() + ".enddate");
result = getDate("organization.memberof." + this.federation.getName() + ".enddate");
//
return result;
@ -548,7 +548,7 @@ public class Organization extends PathPropertyList
{
String result;
result = get("organization.memberof." + this.federation.getTechnicalName() + ".enddate");
result = get("organization.memberof." + this.federation.getName() + ".enddate");
//
return result;
@ -586,7 +586,7 @@ public class Organization extends PathPropertyList
{
LocalDate result;
result = getDate("organization.memberof." + this.federation.getTechnicalName() + ".startdate");
result = getDate("organization.memberof." + this.federation.getName() + ".startdate");
//
return result;
@ -618,7 +618,7 @@ public class Organization extends PathPropertyList
{
String result;
result = get("organization.memberof." + this.federation.getTechnicalName() + ".startdate");
result = get("organization.memberof." + this.federation.getName() + ".startdate");
//
return result;
@ -1399,45 +1399,21 @@ public class Organization extends PathPropertyList
return result;
}
/**
* Sets the federation.
*
* @param federation
* the new federation
*/
public void setFederation(final Federation federation)
{
this.federation = federation;
}
/**
* Sets the input file.
*
* @param inputFile
* the new input file
*/
public void setInputFile(final File inputFile)
{
this.inputFile = inputFile;
}
/**
* Sets the input URL.
*
* @param inputURL
* the new input URL
*/
public void setInputURL(final URL inputURL)
{
this.inputURL = inputURL;
}
/**
* Sets the logo file name.
*
* @param logoFileName
* the new logo file name
*/
public void setLogoFileName(final String logoFileName)
{
this.logoFileName = logoFileName;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -21,9 +21,6 @@ package fr.devinsy.statoolinfos.core;
import java.time.Year;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
/**
* The Class Organizations.
@ -40,22 +37,6 @@ public class Organizations extends ArrayList<Organization>
super();
}
/**
* Instantiates a new organizations.
*
* @param organization
* the organization
*/
public Organizations(final Organization organization)
{
super();
if (organization != null)
{
add(organization);
}
}
/**
* Filter active.
*
@ -246,43 +227,6 @@ public class Organizations extends ArrayList<Organization>
return result;
}
/**
* Gets the by technical name.
*
* @param technicalName
* the technical name
* @return the by technical name
*/
public Organization getByTechnicalName(final String technicalName)
{
Organization result;
Iterator<Organization> iterator = this.iterator();
boolean ended = false;
result = null;
while (!ended)
{
if (iterator.hasNext())
{
Organization organization = iterator.next();
if (StringUtils.equals(organization.getTechnicalName(), technicalName))
{
ended = true;
result = organization;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Gets the idles.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -27,10 +27,12 @@ import java.time.YearMonth;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.checker.PropertyChecks;
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
import fr.devinsy.statoolinfos.properties.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathPropertyList;
import fr.devinsy.statoolinfos.uptime.URLSet;
@ -43,6 +45,8 @@ public class Service extends PathPropertyList
{
private static final long serialVersionUID = 3629841771102288863L;
private static Logger logger = LoggerFactory.getLogger(Service.class);
public enum HostProviderType
{
HOME,
@ -219,11 +223,6 @@ public class Service extends PathPropertyList
return result;
}
/**
* Gets the crawl journal.
*
* @return the crawl journal
*/
public CrawlJournal getCrawlJournal()
{
return this.crawlJournal;
@ -391,11 +390,6 @@ public class Service extends PathPropertyList
return result;
}
/**
* Gets the input checks.
*
* @return the input checks
*/
public PropertyChecks getInputChecks()
{
return this.inputChecks;
@ -423,21 +417,11 @@ public class Service extends PathPropertyList
return result;
}
/**
* Gets the input file.
*
* @return the input file
*/
public File getInputFile()
{
return this.inputFile;
}
/**
* Gets the input URL.
*
* @return the input URL
*/
public URL getInputURL()
{
return this.inputURL;
@ -525,11 +509,6 @@ public class Service extends PathPropertyList
return result;
}
/**
* Gets the metrics.
*
* @return the metrics
*/
public MetricsList getMetrics()
{
return this.metricsList;
@ -1287,45 +1266,21 @@ public class Service extends PathPropertyList
return result;
}
/**
* Sets the input file.
*
* @param inputFile
* the new input file
*/
public void setInputFile(final File inputFile)
{
this.inputFile = inputFile;
}
/**
* Sets the input URL.
*
* @param inputURL
* the new input URL
*/
public void setInputURL(final URL inputURL)
{
this.inputURL = inputURL;
}
/**
* Sets the logo file name.
*
* @param logoFileName
* the new logo file name
*/
public void setLogoFileName(final String logoFileName)
{
this.logoFileName = logoFileName;
}
/**
* Sets the organization.
*
* @param organization
* the new organization
*/
public void setOrganization(final Organization organization)
{
this.organization = organization;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -22,7 +22,6 @@ import java.time.LocalDate;
import java.time.Year;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
@ -43,22 +42,6 @@ public class Services extends ArrayList<Service>
super();
}
/**
* Instantiates a new services.
*
* @param service
* the service
*/
public Services(final Service service)
{
super();
if (service != null)
{
add(service);
}
}
/**
* Count by year.
*
@ -207,43 +190,6 @@ public class Services extends ArrayList<Service>
return result;
}
/**
* Gets the by technical name.
*
* @param technicalName
* the technical name
* @return the by technical name
*/
public Service getByTechnicalName(final String technicalName)
{
Service result;
Iterator<Service> iterator = this.iterator();
boolean ended = false;
result = null;
while (!ended)
{
if (iterator.hasNext())
{
Service service = iterator.next();
if (StringUtils.equals(service.getTechnicalName(), technicalName))
{
ended = true;
result = service;
}
}
else
{
ended = true;
result = null;
}
}
//
return result;
}
/**
* Gets the older.
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -72,31 +72,16 @@ public class Software
this.aliases = new StringList(softwares);
}
/**
* Gets the aliases.
*
* @return the aliases
*/
public StringList getAliases()
{
return this.aliases;
}
/**
* Gets the description.
*
* @return the description
*/
public String getDescription()
{
return this.description;
}
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
return this.name;
@ -117,30 +102,20 @@ public class Software
return result;
}
/**
* Sets the description.
*
* @param description
* the new description
*/
public void setDescription(final String description)
{
this.description = description;
}
/**
* Sets the name.
*
* @param name
* the new name
*/
public void setName(final String name)
{
this.name = name;
}
/*
* {@inheritDoc}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -77,8 +77,6 @@ public class Softwares extends HashMap<String, Software>
*/
public void put(final Software software)
{
put(buildKey(software.getName()), software);
for (String alias : software.getAliases())
{
put(buildKey(alias), software);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.app;
package fr.devinsy.statoolinfos.core;
import java.io.File;
import java.io.IOException;
@ -28,19 +28,13 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.build.Builder;
import fr.devinsy.statoolinfos.core.BotFilter;
import fr.devinsy.statoolinfos.core.Configuration;
import fr.devinsy.statoolinfos.core.Factory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosContext;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.Crawler;
import fr.devinsy.statoolinfos.htmlize.Htmlizer;
import fr.devinsy.statoolinfos.metrics.Prober;
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLog;
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLogs;
import fr.devinsy.statoolinfos.metrics.httperrorlog.HttpErrorLog;
import fr.devinsy.statoolinfos.metrics.httperrorlog.HttpErrorLogs;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLog;
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogs;
import fr.devinsy.statoolinfos.properties.PathProperties;
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
import fr.devinsy.statoolinfos.stats.ip.IpStat;
@ -58,11 +52,11 @@ import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
/**
* The Class StatoolInfosApp.
* The Class StatoolInfos.
*/
public class StatoolInfosApp
public class StatoolInfos
{
private static Logger logger = LoggerFactory.getLogger(StatoolInfosApp.class);
private static Logger logger = LoggerFactory.getLogger(StatoolInfos.class);
/**
* Builds the.
@ -96,6 +90,7 @@ public class StatoolInfosApp
Builder.clear(configuration);
new Crawler(configuration.getCrawlCacheDirectory()).clear();
Htmlizer.clear(configuration);
}
/**
@ -153,13 +148,28 @@ public class StatoolInfosApp
}
}
/**
* Htmlize.
*
* @param configurationFile
* the input
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void htmlize(final File configurationFile) throws StatoolInfosException, IOException
{
Htmlizer.htmlize(configurationFile);
}
/**
* List files.
*
* @param configurationFile
* the configuration file
*/
public static void listAccessFiles(final File configurationFile)
public static void listFiles(final File configurationFile)
{
try
{
@ -187,6 +197,10 @@ public class StatoolInfosApp
{
exception.printStackTrace();
}
catch (IOException exception)
{
exception.printStackTrace();
}
}
/**
@ -195,7 +209,7 @@ public class StatoolInfosApp
* @param files
* the files
*/
public static void listAccessFiles(final Files files)
public static void listFiles(final Files files)
{
if (files != null)
{
@ -209,195 +223,6 @@ public class StatoolInfosApp
}
}
/**
* List error files.
*
* @param configurationFile
* the configuration file
*/
public static void listErrorFiles(final File configurationFile)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Listing HttpErrorLog files from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== List HttpErrorLog files.");
String source = configuration.getProbeHttpErrorLogSource();
logger.info("source=[{}]", source);
Files files = FilesUtils.searchByWildcard(source);
for (File file : files)
{
System.out.println(file.getAbsolutePath());
}
}
}
catch (StatoolInfosException exception)
{
exception.printStackTrace();
}
}
/**
* List error files.
*
* @param files
* the files
*/
public static void listErrorFiles(final Files files)
{
if (files != null)
{
System.out.println("Listing HttpErrorLog files from [" + files.toString() + "]");
logger.info("== List HttpErrorLog files");
for (File file : files)
{
System.out.println(file.getAbsolutePath());
}
}
}
/**
* List error logs.
*
* @param configurationFile
* the configuration file
*/
public static void listErrorLogs(final File configurationFile)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpErrorLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpErrorLog lines.");
String source = configuration.getProbeHttpErrorLogSource();
String dateTimePattern = configuration.getProbeHttpErrorLogDateTimePattern();
String pattern = configuration.getProbeHttpErrorLogPattern();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
HttpErrorLogs logs = new HttpErrorLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern);
for (HttpErrorLog log : logs)
{
System.out.println(log.toStringLog());
}
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* List error logs.
*
* @param source
* the source
*/
public static void listErrorLogs(final Files source)
{
try
{
HttpErrorLogs logs = new HttpErrorLogs(source);
for (HttpErrorLog log : logs)
{
System.out.println(log.toStringLog());
}
}
catch (IllegalArgumentException exception)
{
System.out.println("Bad format line detected. Aborting…");
exception.printStackTrace();
}
catch (DateTimeParseException exception)
{
System.out.println("Bad datetime format detected. Aborting…");
}
catch (IOException exception)
{
System.out.println("File error detected. Aborting…");
exception.printStackTrace();
}
}
/**
* List ips.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void listIps(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
IpStator stator = new IpStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
for (IpStat stat : stator.getIps())
{
System.out.println(stat.getValue());
}
System.err.println(String.format("%s %10d", "Ip count: ", stator.getIps().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* List ips.
*
@ -410,9 +235,9 @@ public class StatoolInfosApp
{
try
{
Chrono chrono = new Chrono().start();
IpStator stator = new IpStator();
Chrono chrono = new Chrono().start();
HttpAccessLogs logs = new HttpAccessLogs(source);
for (HttpAccessLog log : logs)
{
@ -470,15 +295,13 @@ public class StatoolInfosApp
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, pathFilter);
for (HttpAccessLog log : logs)
{
@ -533,73 +356,11 @@ public class StatoolInfosApp
}
}
/**
* List user agents.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void listUserAgents(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
UserAgentStator stator = new UserAgentStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
for (UserAgentStat stat : stator.getUserAgentStats().sortByLabel())
{
System.out.println(stat.getUserAgent());
}
System.err.println(String.format("%s %10d", "UserAgent count: ", stator.getUserAgentStats().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* List user agents.
*
* @param source
* the source
* @param filter
* the filter
*/
public static void listUserAgents(final Files source, final BotFilter filter)
{
@ -643,72 +404,11 @@ public class StatoolInfosApp
}
}
/**
* List visitors.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void listVisitors(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
VisitorStator stator = new VisitorStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
for (VisitorStat stat : stator.getVisitorStats().sortByIp())
{
System.out.println(stat.getIp() + " " + stat.getUserAgent());
}
System.err.println(String.format("%s %10d", "Visitor count: ", stator.getVisitorStats().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* List visitors.
*
* @param source
* the source
* @param filter
* the filter
*/
public static void listVisitors(final Files source, final BotFilter filter)
{
@ -753,12 +453,10 @@ public class StatoolInfosApp
}
/**
* Probe.
* Stat.
*
* @param configurationFile
* the configuration file
* @param dayCountFilter
* the day count filter
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
@ -769,73 +467,11 @@ public class StatoolInfosApp
Prober.probe(configurationFile, dayCountFilter);
}
/**
* Stat ips.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void statIps(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
IpStator stator = new IpStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
System.err.println("IpCount Ip");
for (IpStat stat : stator.getIps().sortByCount().reverse())
{
System.out.println(stat.getCount() + " " + stat.getValue());
}
System.err.println(String.format("%s %10d", "Ip count: ", stator.getIps().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* Stat ips.
*
* @param source
* the source
* @param filter
* the filter
*/
public static void statIps(final Files source, final BotFilter filter)
{
@ -880,73 +516,11 @@ public class StatoolInfosApp
}
}
/**
* Stat user agents.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void statUserAgents(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
UserAgentStator stator = new UserAgentStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
System.err.println("LogCount IpCount VisitCount UserAgent");
for (UserAgentStat stat : stator.getUserAgentStats().sortByCount().reverse())
{
System.out.println(String.format("%d %d %d %s", stat.getLogCount(), stat.getIpCount(), stat.getVisitCount(), stat.getUserAgent()));
}
System.err.println(String.format("%s %10d", "User Agent count: ", stator.getUserAgentStats().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* Stat user agents.
*
* @param source
* the source
* @param filter
* the filter
*/
public static void statUserAgents(final Files source, final BotFilter filter)
{
@ -991,76 +565,11 @@ public class StatoolInfosApp
}
}
/**
* Stat visitors.
*
* @param configurationFile
* the configuration file
* @param filter
* the filter
*/
public static void statVisitors(final File configurationFile, final BotFilter filter)
{
try
{
if ((configurationFile == null) || (!configurationFile.exists()))
{
System.out.println("No configuration file found.");
}
else
{
System.out.println("Testing HttpAccesLog lines from [" + configurationFile.toString() + "]");
Configuration configuration = Factory.loadConfiguration(configurationFile);
logger.info("== Testing HttpAccessLog lines.");
String source = configuration.getProbeHttpAccessLogSource();
String dateTimePattern = configuration.getProbeHttpAccessLogDateTimePattern();
String pattern = configuration.getProbeHttpAccessLogPattern();
String pathFilter = configuration.getProbeHttpAccessLogPathFilter();
logger.info("source=[{}]", source);
logger.info("pattern=[{}]", pattern);
logger.info("dateTimePattern=[{}]", dateTimePattern);
logger.info("pathFilter=[{}]", pathFilter);
Chrono chrono = new Chrono().start();
VisitorStator stator = new VisitorStator();
HttpAccessLogs logs = new HttpAccessLogs(FilesUtils.searchByWildcard(source), pattern, dateTimePattern, pathFilter);
for (HttpAccessLog log : logs)
{
if (filter.matches(log))
{
stator.putLog(log);
}
}
System.err.println("VisitCount LogCount VisitDuration VisitDuration Ip UserAgent");
for (VisitorStat stat : stator.getVisitorStats().sortByVisitCount().reverse())
{
System.out.println(
String.format("%d %d %d %s %s %s", stat.getVisits().size(), stat.getLogCount(), stat.getVisits().getDurationSum().toSeconds(),
Chrono.format(stat.getVisits().getDurationSum()),
stat.getIp(), stat.getUserAgent()));
}
System.err.println(String.format("%s %10d", "Visitor count: ", stator.getVisitorStats().size()));
System.err.println(String.format("%s %10d", "Log count: ", stator.getLogCount()));
System.err.println(chrono.format());
}
}
catch (Exception exception)
{
logger.error("Error: {}", exception.getMessage());
exception.printStackTrace();
}
}
/**
* Stat visitors.
*
* @param source
* the source
* @param filter
* the filter
*/
public static void statVisitors(final Files source, final BotFilter filter)
{
@ -1165,11 +674,11 @@ public class StatoolInfosApp
*/
public static void uptime(final File configurationFile) throws StatoolInfosException, IOException
{
StatoolInfosContext context = new StatoolInfosContext(configurationFile);
HtmlizerContext.instance().configure(configurationFile);
UptimeJournal journal = context.getUptimeJournal();
Federation federation = context.getFederation();
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
Federation federation = HtmlizerContext.instance().getFederation();
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
context.getCache().storeUptimeJournal(journal);
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -50,6 +50,8 @@ import org.apache.tika.Tika;
import org.apache.tika.mime.MimeType;
import org.apache.tika.mime.MimeTypeException;
import org.apache.tika.mime.MimeTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.strings.StringList;
import fr.devinsy.strings.StringsUtils;
@ -59,6 +61,8 @@ import fr.devinsy.strings.StringsUtils;
*/
public class StatoolInfosUtils
{
private static Logger logger = LoggerFactory.getLogger(StatoolInfosUtils.class);
public static final DateTimeFormatter PATTERN_SHORTDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRANCE);
public static final DateTimeFormatter PATTERN_LONGDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE);
@ -607,13 +611,6 @@ public class StatoolInfosUtils
return result;
}
/**
* To integer.
*
* @param value
* the value
* @return the integer
*/
public static Integer toInteger(final String value)
{
Integer result;
@ -824,7 +821,6 @@ public class StatoolInfosUtils
* the url
* @return the local date time
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static LocalDateTime urlLastModified(final URL url) throws IOException
{

View file

@ -1,438 +0,0 @@
# Warning: UTF-8 file.
# History:
# 2021-2023 CHATONS stats workgroup with Angie from Framasoft, MrFlo and Cpm.
# 2024 Cpm.
# [Categories]
# Outils de communication
## Courrier électronique / mail (alternative à Gmail, Hotmail, YahooMail, etc.)
categories.mail.name=Courrier électronique
categories.mail.description=
categories.mail.logo=mail.svg
categories.mail.softwares=BlueMind, Rainloop, Roundcube, SOgo, Mailman, Dovecot, Postfix, Snappymail
## Carnet d'adresse (alternative à Google Contacts)
categories.adressbook.name=Carnet d'adresses
categories.adressbook.description=
categories.adressbook.logo=adressbook.svg
categories.adressbook.softwares=Radicale, SOgo, Nextcloud Contact, Nextcloud, Davical, InfCloud
## Liste de diffusion (alternative à Google Groupes)
categories.mailinglist.name=Liste de diffusion
categories.mailinglist.description=
categories.mailinglist.logo=mailinglist.svg
categories.mailinglist.softwares=Sympa
## Lettres d'information (alternative à MailChimp)
categories.newsletter.name=Lettres d'informations
categories.newsletter.description=Générateur de lettres d'information
categories.newsletter.logo=newsletter.svg
categories.newsletter.softwares=PHPList, wassup
## Audioconférence (alternative à Discord)
categories.audioconf.name=Audioconférence
categories.audioconf.description=
categories.audioconf.logo=audioconf.svg
categories.audioconf.softwares=Mumble, MumbleWeb, Mumble Web, Wire
## Visioconférence (alternative à Skype, Hangouts, etc.)
categories.videoconf.name=Visioconférence
categories.videoconf.description=Pour faire des visio-conférences.
categories.videoconf.logo=videoconf.svg
categories.videoconf.softwares=Jitsi, Jitsi Meet, BigBlueButton, OpenMeetings, Jami, Nextcloud Talk, Galène
## Messagerie instantanée (alternative à Slack)
categories.im.name=Messagerie instantanée
categories.im.description=
categories.im.logo=im.svg
categories.im.softwares=Mattermost, RocketChat, MongooseIM, Tracim, Twake, BitlBee
## Chat IRC ou Jabber (alternative à MSN)
categories.chat.name=Chat
categories.chat.description=
categories.chat.logo=chat.svg
categories.chat.softwares=IRC, Jabber, ejabberd, Synapse, Metronome, Matrix, Element, Element Web, Riot, Prosody, MyCryptoChat, Converse, Glowing bear, BitlBee
## Forum (alternative à Discord)
categories.forum.name=Forum
categories.forum.description=
categories.forum.logo=forum.svg
categories.forum.softwares=Discourse, Flarum
## Réseau social (alternative à Facebook)
categories.socialnetwork.name=Réseau social
categories.socialnetwork.description=
categories.socialnetwork.logo=socialnetwork.svg
categories.socialnetwork.softwares=Diaspora*, Movim
## Microblogging (alternative à Twitter)
categories.microblogging.name=Microblogging
categories.microblogging.description=
categories.microblogging.logo=microblogging.svg
categories.microblogging.softwares=Mastodon, Pleroma
## Organisation d'évènements (alternative aux évènements Facebook, MeetUp, EventBrite)
categories.events.name=Organisation d'évènements
categories.events.description=
categories.events.logo=events.svg
categories.events.softwares=Mobilizon
## Gestion de groupes (alternative aux groupes Facebook)
categories.groups.name=Gestion de groupes
categories.groups.description=
categories.groups.logo=groups.svg
categories.groups.softwares=Mobilizon, Agorakit
## Gestionnaire de notifications
categories.notifications.name=Gestionnaire de notifications
categories.notifications.description=
categories.notifications.logo=notifications.svg
categories.notifications.softwares=ntfy
# Outils Internet
## Moteur de recherche (alternative à Google Search)
categories.search.name=Moteur de recherche
categories.search.description=
categories.search.logo=search.svg
categories.search.softwares=SearX
## Serveurs de jeux vidéo
categories.videogames.name=Serveurs de jeux vidéo
categories.videogames.description=
categories.videogames.logo=videogames.svg
categories.videogames.softwares=Minetest, Trivabble, Codenames Green, Terraforming Mars
## Cartographie (alternative à Google Maps, Mappy, etc.)
categories.maps.name=Cartographie
categories.maps.description=
categories.maps.logo=maps.svg
categories.maps.softwares=OpenStreetMap, GoGoCarto, uMap
## Outils de sondage (alternative à SurveyMonkey)
categories.survey.name=Sondage
categories.survey.description=
categories.survey.logo=survey.svg
categories.survey.softwares=LimeSurvey
## Outils de traduction
categories.translator.name=Outils de traduction
categories.translator.description=
categories.translator.logo=translator.svg
categories.translator.softwares=LibreTranslate, Weblate, Zanata
## Générateur de code-barres
categories.barcode.name=Générateur de code-barres
categories.barcode.description=
categories.barcode.logo=qrcode.svg
categories.barcode.softwares=LibreQR
## Raccourcisseur d'URL (alternative à Bit.ly, tinyurl, etc.)
categories.urlshrinker.name=Raccourcisseur d'URL
categories.urlshrinker.description=Pour partager des URL raccourcies.
categories.urlshrinker.logo=urlshrinker.svg
categories.urlshrinker.softwares=Yourls, LSTU, Rs-Short, Polr
## Transfert de messages ou de bouts de textes (alternative à PasteBin)
categories.bin.name=Transfert de messages ou de bouts de texte
categories.bin.description=
categories.bin.logo=bin.svg
categories.bin.softwares=PrivateBin, 0bin.net, Paste
## Gestionnaire de marques-pages / favoris (alternative à Del.icio.us, Diigo, Pearltrees, etc.)
categories.bookmarks.name=Gestionnaire de marques-pages
categories.bookmarks.description=
categories.bookmarks.logo=bookmarks.svg
categories.bookmarks.softwares=Shaarli
## Générateur de flux RSS
categories.rssgen.name=Générateur de flux RSS
categories.rssgen.description=
categories.rssgen.logo=rssgen.svg
categories.rssgen.softwares=RSS Bridge
## Agrégateur de flux RSS (alternative à Netvibes, Feedly, InoReader, etc.)
categories.rss.name=Agrégateur de flux RSS
categories.rss.description=
categories.rss.logo=rss.svg
categories.rss.softwares=Cyca, FreshRSS, Tiny Tiny RSS
## Sauvegarde de contenus web (alternative à Pocket, Instapaper, etc.)
categories.saveforlater.name=Sauvegarde de contenus web
categories.saveforlater.description=
categories.saveforlater.logo=saveforlater.svg
categories.saveforlater.softwares=Wallabag
## Gestionnaire de mots de passe (alternative à LastPass, Dashlane, etc.)
categories.password.name=Gestionnaire de mots de passe
categories.password.description=
categories.password.logo=password.svg
categories.password.softwares=Bitwarden, Vaultwarden, Nextcloud Passman
## Forge logicielle (alternative à Github)
categories.git.name=Forge logicielle
categories.git.description=Pour partager des dépôts versionnés
categories.git.logo=git.svg
categories.git.softwares=GitLab, GitLab CE,GitLabCE,Gogs,Gitea,Gitolite, Forgejo
## Mesure de statistiques (alternative à Google Analytics)
categories.metrics.name=Mesure de statistiques
categories.metrics.description=
categories.metrics.logo=metrics.svg
categories.metrics.softwares=Matomo, Open Web Analytics, Dolomon
## Proxy - Intermédiaire de relais et/ou d'anonymisation
categories.proxy.name=Proxy
categories.proxy.description=
categories.proxy.logo=proxy.svg
categories.proxy.softwares=Squid, Nitter,Invidious, Bibliogram, PeerJS Server, PeerServer, Coturn
## VPN - Réseau privé virtuel
categories.vpn.name=VPN
categories.vpn.description=
categories.vpn.logo=vpn.svg
categories.vpn.softwares=OpenVPN, tinc
# Outils de travail
## Agenda partagé (alternative à Google Agenda)
categories.calendar.name=Agenda
categories.calendar.description=
categories.calendar.logo=calendar.svg
categories.calendar.softwares=Radicale, SOgo, Nextcloud Calendar, Nextcloud, Tracim, Baïkal, Davical, InfCloud
## Rédaction collaborative (alternative à Google Docs)
categories.pad.name=Traitement de texte collaboratif
categories.pad.description=
categories.pad.logo=pad.svg
categories.pad.softwares=Etherpad, Etherpad-lite, CodiMD, Cryptpad, HedgeDoc, MyPads, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online, Tracim Collabora Online, Libreto
## Tableur collaboratif (alternative à Google Sheets)
categories.calc.name=Tableur collaboratif
categories.calc.description=
categories.calc.logo=calc.svg
categories.calc.softwares=Ethercalc, Cryptpad, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online
## Tableau blanc collaboratif (alternative à Stoodle)
categories.board.name=Tableau blanc collaboratif
categories.board.description=
categories.board.logo=board.svg
categories.board.softwares=Scrumblr, Whiteboard
## Présentation collaborative (alternative à Google Drive)
categories.slide.name=Présentation en ligne
categories.slide.description=
categories.slide.logo=slide.svg
categories.slide.softwares=Strut, Nextcloud OnlyOffice, Nextcloud Collabora Online, OnlyOffice, Collabora Online
## Questionnaire en ligne (alternative à Google Forms)
categories.form.name=Questionnaire en ligne
categories.form.description=
categories.form.logo=form.svg
categories.form.softwares=Yakforms
## Aide à la prise de rendez-vous (alternative à Doodle)
categories.date.name=Aide à la prise de rendez-vous
categories.date.description=
categories.date.logo=date.svg
categories.date.softwares=Framadate, OpenSondage
## Création de schémas et diagrammes (alternative à Visio)
categories.diagram.name=Création de schémas et diagrammes
categories.diagram.description=
categories.diagram.logo=diagram.svg
categories.diagram.softwares=Drawio
## Carte heuristique / mentale (alternative à Mindmeister)
categories.mindmap.name=Carte heuristique
categories.mindmap.description=
categories.mindmap.logo=mindmap.svg
categories.mindmap.softwares=WiseMapping, MyMind, My Mind
## Gestionnaire de tâches (alternative à Google Tasks)
categories.tasks.name=Gestionnaire de tâches
categories.tasks.description=
categories.tasks.logo=tasks.svg
categories.tasks.softwares= Taskwarrior
## Prise de note (alternative à Evernote, OneNote, etc.)
categories.notes.name=Prise de note
categories.notes.description=
categories.notes.logo=notes.svg
categories.notes.softwares=Turtl, Tracim
## Tableau Kanban (alternative à Trello, Asana, etc.)
categories.kanbanboard.name=Tableau Kanban
categories.kanbanboard.description=
categories.kanbanboard.logo=kanban.svg
categories.kanbanboard.softwares=Kanboard, Wekan, Nullboard
## Outils de prise de décision (alternative à Klaxoon)
categories.decision.name=Outils de prise de décision
categories.decision.description=
categories.decision.logo=decision.svg
categories.decision.softwares=Loomio, VotAR
## Gestionnaire de signature électronique
categories.electronicsignature.name=Gestionnaire de signature électronique
categories.electronicsignature.description=
categories.electronicsignature.logo=esignature.svg
categories.electronicsignature.softwares=Signature PDF
## Plateforme de formation / LMS
categories.lms.name=Plateforme de formation / LMS (Learning Management System)
categories.lms.description=
categories.lms.logo=lms.svg
categories.lms.softwares=Moodle, Scenarii, YesWiki, Open edX
# Services de partage de fichiers
## Stockage / partage de documents (alternative à Dropbox, Google Drive, OneDrive, etc.)
categories.cloud.name=Stockage/ partage de documents
categories.cloud.description=
categories.cloud.logo=cloud.svg
categories.cloud.softwares=Nextcloud, Owncloud, Seafile, Tracim, Minio, ProFTPD
## Partage temporaire de fichiers (alternative à WeTransfer, DropSend)
categories.temporaryfilesharing.name=Partage temporaire de fichiers
categories.temporaryfilesharing.description=Pour partager des fichiers de façon temporaire.
categories.temporaryfilesharing.logo=temporaryfilesharing.svg
categories.temporaryfilesharing.softwares=Firefox Send,FirefoxSend, Lufi, FileToLink, File2Link, Plik
## Stockage/partage d'images (alternative à Img.ur)
categories.pic.name= Stockage et partage d'images
categories.pic.description=
categories.pic.logo=pic.svg
categories.pic.softwares=Lutim, Pixelfed
## Stockage/partage d'albums de photos (alternative à Google Photos, Flickr, etc.)
categories.gallery.name= Stockage et partage d'albums photos
categories.gallery.description=
categories.gallery.logo=gallery.svg
categories.gallery.softwares=Piwigo, Mediagoblin
## Diffusion de fichiers vidéos (alternative à YouTube, DailyMotion, Viméo, etc.)
categories.tube.name= Diffusion de fichiers vidéo
categories.tube.description=
categories.tube.logo=tube.svg
categories.tube.softwares=PeerTube, Mediagoblin
## Diffusion de fichiers audio (alternative à Soundcloud)
categories.podcast.name= Diffusion de fichiers audio
categories.podcast.description=
categories.podcast.logo=podcast.svg
categories.podcast.softwares=Funkwhale, Mediagoblin
## Diffusion en direct de flux audio et vidéo
categories.streaming.name= Diffusion en direct de flux audio et vidéo
categories.streaming.description=
categories.streaming.logo=streaming.svg
categories.streaming.softwares=PeerTube, Icecast
## Hébergement de sites web / blogs / capsules
categories.website.name= Hébergement de sites web / blogs / capsules
categories.website.description=
categories.website.logo=website.svg
categories.website.softwares=Wordpress, Joomla!, Plume, SPIP, Grav, PrettyNoemie CMS, Write Freely, Vger, ISPconfig, Garage, Apache Httpd, Nginx, Twins
## Hébergement d'une plateforme de commentaires (alternative à Disqus)
categories.commenting.name=Hébergement d'une plateforme de commentaires
categories.commenting.description=
categories.commenting.logo=commenting.svg
categories.commenting.softwares=Commento
## Hébergement de wikis
categories.wiki.name=Wiki
categories.wiki.description=Modification collaborative de texte
categories.wiki.logo=wiki.svg
categories.wiki.softwares=Dokuwiki, Mediawiki
## Hébergement d'une ferme de wikis
categories.wikifarm.name= Hébergement d'une ferme de wikis
categories.wikifarm.description=
categories.wikifarm.logo=wikifarm.svg
categories.wikifarm.softwares=YesWiki, Bookstack
# Services de gestion
## Gestionnaire de finances personnelles
categories.finance.name=Gestionnaire de finances personnelles
categories.finance.description=
categories.finance.logo=finance.svg
categories.finance.softwares=Kresus, IHateMoney
## Gestionnaire de facturation / paiement
categories.billing.name=Gestionnaire de facturation / paiement
categories.billing.description=
categories.billing.logo=billing.svg
categories.billing.softwares=
## Progiciel de Gestion Intégré (PGI, ERP en anglais)
categories.erp.name=Progiciel de Gestion Intégré
categories.erp.description=
categories.erp.logo=erp.svg
categories.erp.softwares=Dolibarr, Odoo, Diacamma
## Progiciel de Gestion associative
categories.asso.name=Progiciel de Gestion associative
categories.asso.description=
categories.asso.logo=association.svg
categories.asso.softwares=Bénévalibre, Galette, Structura, Garradin, Paheko
## Gestionnaire de tickets pour le support technique
categories.ticketing.name=Gestionnaire de tickets pour le support technique
categories.ticketing.description=
categories.ticketing.logo=ticketing.svg
categories.ticketing.softwares=Mantis, MantisBT, Redmine, Gitlab, Gitea, RT, Request Tracker, OSTicket, Freescout
# Outils d'administration système
## Outils de monitoring
categories.monitoring.name=Outils de monitoring
categories.monitoring.description=
categories.monitoring.logo=monitoring.svg
categories.monitoring.softwares=Healthchecks, Monitorix, Gotify, naemon
## Outils d'automatisation
categories.automated.name=Outils d'automatisation
categories.automated.description=
categories.automated.logo=automated.svg
categories.automated.softwares=CyberChef, Buildbot
## Administration de machines virtuelles
categories.vps.name=Administration de machines virtuelles
categories.vps.description=
categories.vps.logo=vps.svg
categories.vps.softwares=Ganeti
## Fournisseur de machines physiques ou virtuelles
categories.server.name= Fournisseur de comptes Shell, machines physiques ou virtuelles
categories.server.description=
categories.server.logo=server.svg
categories.server.softwares=OpenSSH, Docker, KVM, QEMU, libvirt, VirtualBox, Proxmox
## Fournisseur de stockage (accès à un support de stockage, sans faire tourner des applications)
categories.storage.name= Fournisseur de stockage
categories.storage.description=
categories.storage.logo=storage.svg
categories.storage.softwares=MinIO, BorgBackup, borgmatic, Garage, ProFTPD, rsync
## Fournisseur de bases de données
categories.database.name= Fournisseur de bases de données
categories.database.description=
categories.database.logo=database.svg
categories.database.softwares=MariaDB, PostgreSQL, MongoDB, SQLite, Redis, CouchDb, Cassandra
## Résilience - Outils de réplication et de backup
categories.resilience.name=Outils de réplication et de backup
categories.resilience.description=
categories.resilience.logo=resilience.svg
categories.resilience.softwares=MariaDB, PostgreSQL, rsync
## Outils de DNS
categories.dns.name=Outils de DNS
categories.dns.description=
categories.dns.logo=dns.svg
categories.dns.softwares=bind9

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -116,11 +116,6 @@ public class CrawlCache
}
}
/**
* Gets the directory.
*
* @return the directory
*/
public File getDirectory()
{
return this.directory;
@ -239,7 +234,7 @@ public class CrawlCache
}
else
{
logger.info("Restoring logo from {}", url);
logger.info("CatGeneratoring from {}", url);
File logoFile = restoreFile(url);
if (logoFile == null)
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -34,8 +34,6 @@ public class CrawlLog
*
* @param url
* the url
* @param parentUrl
* the parent url
* @param status
* the status
*/
@ -46,11 +44,6 @@ public class CrawlLog
this.status = status;
}
/**
* Gets the parent url.
*
* @return the parent url
*/
public URL getParentUrl()
{
return this.parentUrl;
@ -78,21 +71,11 @@ public class CrawlLog
return result;
}
/**
* Gets the status.
*
* @return the status
*/
public CrawlStatus getStatus()
{
return this.status;
}
/**
* Gets the url.
*
* @return the url
*/
public URL getUrl()
{
return this.url;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -68,8 +68,6 @@ public class CrawlLogs extends ArrayList<CrawlLog>
*
* @param url
* the url
* @param parentUrl
* the parent url
* @param status
* the status
*/

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -18,9 +18,6 @@
*/
package fr.devinsy.statoolinfos.crawl;
/**
* The Enum CrawlStatus.
*/
public enum CrawlStatus
{
BADCHILDCLASS,
@ -34,11 +31,6 @@ public enum CrawlStatus
UPDATED,
URLNOTFOUND;
/**
* Checks if is error.
*
* @return true, if is error
*/
public boolean isError()
{
boolean result;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -250,8 +250,6 @@ public class Crawler
*
* @param url
* the url
* @param parentURL
* the parent URL
* @return the file
*/
public File crawlLogo(final URL url, final URL parentURL)
@ -349,7 +347,6 @@ public class Crawler
*
* @return the crawl journal
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public CrawlJournal restoreJournal() throws IOException
{

View file

@ -0,0 +1,95 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class AboutPage.
*/
public class AboutPage
{
private static Logger logger = LoggerFactory.getLogger(AboutPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build() throws StatoolInfosException, IOException
{
logger.info("Htmlize about page.");
Federation federation = HtmlizerContext.instance().getFederation();
CrawlCache cache = HtmlizerContext.instance().getCache();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
String page = htmlize();
FileUtils.write(new File(htmlizeDirectory, "about.xhtml"), page, StandardCharsets.UTF_8);
}
/**
* Builds the.
*
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize() throws StatoolInfosException
{
String result;
try
{
logger.debug("Building about page {}.");
TagDataManager data = new TagDataManager();
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/about.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("À propos", "about.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building about page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,92 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
/**
* The Class Breadcrumb.
*/
public class Breadcrumb
{
private String label;
private String link;
/**
* Instantiates a new breadcrumb.
*/
public Breadcrumb()
{
}
/**
* Instantiates a new breadcrumb.
*
* @param label
* the label
* @param link
* the link
*/
public Breadcrumb(final String label, final String link)
{
this.label = label;
this.link = link;
}
/**
* Gets the label.
*
* @return the label
*/
public String getLabel()
{
return this.label;
}
/**
* Gets the link.
*
* @return the link
*/
public String getLink()
{
return this.link;
}
/**
* Sets the label.
*
* @param label
* the new label
*/
public void setLabel(final String label)
{
this.label = label;
}
/**
* Sets the link.
*
* @param link
* the new link
*/
public void setLink(final String link)
{
this.link = link;
}
}

View file

@ -0,0 +1,133 @@
/*
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.util.ArrayList;
import fr.devinsy.strings.StringList;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class BreadcrumbTrail.
*/
public class BreadcrumbTrail extends ArrayList<Breadcrumb>
{
private static final long serialVersionUID = -2688444486042912675L;
/**
* Instantiates a new breadcrumb trail.
*/
public BreadcrumbTrail()
{
this("🏡", "index.xhtml");
}
/**
* Instantiates a new breadcrumb trail.
*
* @param label
* the label
* @param link
* the link
*/
public BreadcrumbTrail(final String label, final String link)
{
super();
add(label, link);
}
/**
* Adds the.
*
* @param label
* the label
* @return the breadcrumb trail
*/
public BreadcrumbTrail add(final String label)
{
BreadcrumbTrail result;
Breadcrumb crumb = new Breadcrumb(label, null);
add(crumb);
result = this;
//
return result;
}
/**
* Adds the.
*
* @param label
* the label
* @param link
* the link
* @return the breadcrumb trail
*/
public BreadcrumbTrail add(final String label, final String link)
{
BreadcrumbTrail result;
Breadcrumb crumb = new Breadcrumb(label, link);
add(crumb);
result = this;
//
return result;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString()
{
String result;
StringList buffer = new StringList();
for (Breadcrumb crumb : this)
{
if (crumb.getLink() == null)
{
buffer.append(XidynUtils.escapeXmlBlank(crumb.getLabel()));
}
else
{
buffer.append(String.format("<a href=\"%s\" style=\"text-decoration: none; padding: 5px;\">%s</a>", crumb.getLink(), XidynUtils.escapeXmlBlank(crumb.getLabel())));
}
buffer.append(" > ");
}
if (buffer.size() > 2)
{
buffer.removeLast();
}
result = buffer.toString();
//
return result;
}
}

View file

@ -0,0 +1,120 @@
/*
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Categories;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.statoolinfos.stats.StatAgent;
import fr.devinsy.statoolinfos.stats.categories.CategoryStat;
import fr.devinsy.statoolinfos.stats.categories.CategoryStats;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class CategoriesPage.
*/
public class CategoriesPage
{
private static Logger logger = LoggerFactory.getLogger(CategoriesPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build() throws StatoolInfosException, IOException
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
Categories categories = HtmlizerContext.instance().getCategories();
logger.info("Htmlize categories page.");
CategoryStats stats = StatAgent.statAllCategories(federation, categories);
String page = CategoriesPage.htmlize(stats);
FileUtils.write(new File(htmlizeDirectory, "categories.xhtml"), page, StandardCharsets.UTF_8);
}
/**
* Builds the.
*
* @param stats
* the stats
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final CategoryStats stats) throws StatoolInfosException
{
String result;
try
{
logger.debug("Building categories page.");
TagDataManager data = new TagDataManager();
data.setContent("categoryCount", stats.size());
int index = 0;
for (CategoryStat stat : stats)
{
data.setEscapedContent("categoryListLine", index, "categoryListLineNameValue", stat.getCategory().getName());
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "href", "category-" + stat.getCategory().getTechnicalName() + ".xhtml");
data.setAttribute("categoryListLine", index, "categoryListLineNameLink", "title", stat.getCategory().getDescription());
data.setAttribute("categoryListLine", index, "categoryListLineNameLogo", "src", stat.getCategory().getLogoPath());
data.setEscapedContent("categoryListLine", index, "categoryListLineSoftwares", stat.getCategory().getSoftwares().sort().toStringWithFrenchCommas());
data.setContent("categoryListLine", index, "categoryListLineOrganizationCount", stat.getOrganizationCount());
data.setContent("categoryListLine", index, "categoryListLineServiceCount", StatoolInfosUtils.defaultIfZero(stat.getServiceCount(), "😿"));
data.setContent("categoryListLine", index, "categoryListLineUserCount", StatoolInfosUtils.defaultIfZero(stat.getUserCount(), "😢"));
data.setContent("categoryListLine", index, "categoryListLineVisitCount", StatoolInfosUtils.defaultIfZero(stat.getVisitCount(), "😞"));
index += 1;
}
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/categories.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Catégories", "categories.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building categories page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,105 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Categories;
import fr.devinsy.statoolinfos.core.Category;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class CategoriesView.
*/
public class CategoriesView
{
private static Logger logger = LoggerFactory.getLogger(CategoriesView.class);
public enum Mode
{
ALL,
ICONS_ONLY,
LABELS_ONLY
}
/**
* Builds the.
*
* @param categories
* the categories
* @param mode
* the mode
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String build(final Categories categories, final Mode mode) throws StatoolInfosException
{
String result;
try
{
logger.debug("Building categories view.");
TagDataManager data = new TagDataManager();
int index = 0;
for (Category category : categories)
{
data.setAttribute("category", index, "categoryLink", "href", "category-" + category.getTechnicalName() + ".xhtml");
if (mode == Mode.ALL)
{
data.setAttribute("category", index, "categoryLink", "title", category.getDescription());
data.setAttribute("category", index, "categoryLogo", "src", category.getLogoPath());
data.setEscapedContent("category", index, "categoryName", category.getName());
}
else if (mode == Mode.ICONS_ONLY)
{
data.setAttribute("category", index, "categoryLink", "title", category.getName());
data.setAttribute("category", index, "categoryLogo", "src", category.getLogoPath());
data.setAttribute("category", index, "categoryName", "class", "xid:nodisplay");
}
else if (mode == Mode.LABELS_ONLY)
{
data.setAttribute("category", index, "categoryLink", "title", category.getDescription());
data.setAttribute("category", index, "categoryLogo", "class", "xid:nodisplay");
data.setEscapedContent("category", index, "categoryName", category.getName());
}
index += 1;
}
String page = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/categoriesView.xhtml", data).toString();
result = XidynUtils.extractBodyContent(page.replaceAll("id=\"[^\"]*\"", ""));
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building categories view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,112 @@
/*
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Categories;
import fr.devinsy.statoolinfos.core.Category;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Services;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.CrawlCache;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class ServicesPage.
*/
public class CategoryPage
{
private static Logger logger = LoggerFactory.getLogger(CategoryPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* @throws IOException
*/
public static void buildAll() throws StatoolInfosException, IOException
{
Federation federation = HtmlizerContext.instance().getFederation();
CrawlCache cache = HtmlizerContext.instance().getCache();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
Categories categories = HtmlizerContext.instance().getCategories();
logger.info("Htmlize category pages.");
for (Category category : categories)
{
Services services = federation.getServices().getBy(category);
String page = CategoryPage.htmlize(category, services);
FileUtils.write(new File(htmlizeDirectory, "category-" + category.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8);
}
}
/**
* Builds the.
*
* @param category
* the category
* @param services
* the services
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Category category, final Services services) throws StatoolInfosException
{
String result;
try
{
logger.debug("Building category page.");
TagDataManager data = new TagDataManager();
data.setAttribute("categoryLogo", "src", category.getLogoPath());
data.setEscapedContent("categoryName", category.getName());
data.setEscapedContent("categoryDescription", category.getDescription());
data.setEscapedContent("categorySoftwares", category.getSoftwares().sort().toStringWithFrenchCommas());
data.setContent("serviceCount", services.size());
data.setContent("serviceListView", ServiceListView.htmlize(services.sortByName()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/category.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Catégories", "categories.xhtml");
trail.add(category.getName(), "category-" + category.getTechnicalName() + ".xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building category page: " + exception.getMessage(), exception);
}
//
return result;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,99 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.time.format.DateTimeFormatter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
import fr.devinsy.statoolinfos.crawl.CrawlLog;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class CrawlJournalPage.
*/
public class CrawlJournalView
{
private static Logger logger = LoggerFactory.getLogger(CrawlJournalView.class);
/**
* Htmlize.
*
* @param journal
* the journal
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final CrawlJournal journal) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setEscapedContent("title", "Journal des téléchargements");
data.setContent("date", journal.getDatetime().format(DateTimeFormatter.ofPattern("dd/MM/YYYY HH:mm")));
data.setContent("totalCount", journal.size());
data.setContent("errorCount", journal.getErrors().size());
int index = 0;
for (CrawlLog log : journal)
{
data.setEscapedContent("crawlLogLine", index, "crawlLogLineParentUrlLink", StringUtils.abbreviate(log.getParentUrlValue(), 35));
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineParentUrlLink", "href", StringUtils.defaultString(log.getParentUrlValue(), "#"));
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineParentUrlLink", "title", StringUtils.defaultString(log.getParentUrlValue(), "#"));
data.setEscapedContent("crawlLogLine", index, "crawlLogLineUrlLink", log.getUrl().toString());
data.setEscapedAttribute("crawlLogLine", index, "crawlLogLineUrlLink", "href", log.getUrl().toString());
data.setContent("crawlLogLine", index, "crawlLogLineStatus", log.getStatus().toString());
if (log.getStatus().isError())
{
data.setAttribute("crawlLogLine", index, "crawlLogLineStatus", "style", "background-color: red;");
}
else
{
data.setAttribute("crawlLogLine", index, "crawlLogLineStatus", "style", "background-color: lime;");
}
index += 1;
}
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/crawlJournalView.xhtml", data).toString();
result = XidynUtils.extractBodyContent(content);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building crawl journal page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,127 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Configuration;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class EditoPage.
*/
public class EditoPage
{
private static Logger logger = LoggerFactory.getLogger(EditoPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build() throws StatoolInfosException, IOException
{
logger.info("Htmlize edito page.");
Configuration configuration = HtmlizerContext.instance().getConfiguration();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
String edito;
File editoDirectory = configuration.getEditoDirectory();
if ((editoDirectory != null) && (editoDirectory.exists()))
{
File editoFile = new File(editoDirectory, "edito.xhtml");
if (editoFile.exists())
{
logger.info("EDITO: found data.");
// Copy files.
FileUtils.copyDirectory(editoDirectory, htmlizeDirectory);
// Load body edito xhtml file.
edito = FileUtils.readFileToString(editoFile, StandardCharsets.UTF_8);
edito = XidynUtils.extractBodyContent(edito);
}
else
{
logger.info("EDITO: not found data.");
edito = null;
}
}
else
{
logger.info("EDITO: not found configuration.");
edito = null;
}
String page = htmlize(edito);
FileUtils.write(new File(htmlizeDirectory, "edito.xhtml"), page, StandardCharsets.UTF_8);
}
/**
* Builds the.
*
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final String edito) throws StatoolInfosException
{
String result;
try
{
logger.debug("Building edito page {}.");
TagDataManager data = new TagDataManager();
if (edito != null)
{
data.setContent("edito", edito);
}
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/edito.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Édito", "edito.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building edito page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,145 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.io.CSVFile;
import fr.devinsy.statoolinfos.io.JSONFile;
import fr.devinsy.statoolinfos.io.ODSFile;
import fr.devinsy.statoolinfos.uptime.ServiceUptimes;
import fr.devinsy.statoolinfos.uptime.ServiceUptimesFile;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class ExportsPage.
*/
public class ExportsPage
{
private static Logger logger = LoggerFactory.getLogger(ExportsPage.class);
/**
* Builds the.
*/
public static void build()
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
//
try
{
logger.info("EXPORTS CSV.");
CSVFile.save(new File(htmlizeDirectory, "organizations.csv"), federation.getOrganizations());
CSVFile.save(new File(htmlizeDirectory, "services.csv"), federation.getServicesAll());
}
catch (IOException exception)
{
logger.error("Error during CSV export: " + exception.getMessage(), exception);
}
//
try
{
logger.info("EXPORTS JSON.");
JSONFile.save(new File(htmlizeDirectory, "federation.json"), federation);
JSONFile.save(new File(htmlizeDirectory, "organizations.json"), federation.getOrganizations());
JSONFile.save(new File(htmlizeDirectory, "services.json"), federation.getServicesAll());
}
catch (IOException exception)
{
logger.error("Error during JSON export: " + exception.getMessage(), exception);
}
//
try
{
logger.info("EXPORTS ODS.");
ODSFile.save(new File(htmlizeDirectory, "organizations.ods"), federation.getOrganizations());
ODSFile.save(new File(htmlizeDirectory, "services.ods"), federation.getServicesAll());
}
catch (Exception exception)
{
logger.error("Error during ODS export: " + exception.getMessage(), exception);
}
//
try
{
logger.info("EXPORTS SERVICE UPTIME JOURNAL.");
ServiceUptimes uptimes = ServiceUptimes.of(federation.getServicesAll(), HtmlizerContext.instance().getUptimeJournal());
ServiceUptimesFile.saveCSV(new File(htmlizeDirectory, "serviceUptimeJournal.csv"), uptimes);
ServiceUptimesFile.saveODS(new File(htmlizeDirectory, "serviceUptimeJournal.ods"), uptimes);
}
catch (Exception exception)
{
logger.error("Error during Uptime export: " + exception.getMessage(), exception);
}
//
try
{
String page = htmlize();
FileUtils.write(new File(htmlizeDirectory, "exports.xhtml"), page, StandardCharsets.UTF_8);
}
catch (StatoolInfosException | IOException exception)
{
logger.error("Error building export page: " + exception.getMessage(), exception);
}
}
/**
* Htmlize.
*
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize() throws StatoolInfosException
{
String result;
try
{
logger.info("PAGE EXPORTS.");
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/exports.xhtml", null).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,74 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class CrawlJournalFederationPage.
*/
public class FederationCrawlJournalPage
{
private static Logger logger = LoggerFactory.getLogger(FederationCrawlJournalPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build() throws StatoolInfosException, IOException
{
try
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
TagDataManager data = new TagDataManager();
data.setContent("headerView", FederationHeaderView.htmlize(federation));
data.setContent("contentView", CrawlJournalView.htmlize(federation.getCrawlJournal()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
String page = WebCharterView.build(content, trail);
FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-crawl.xhtml"), page, StandardCharsets.UTF_8);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation crawl journal page: " + exception.getMessage(), exception);
}
}
}

View file

@ -0,0 +1,153 @@
/*
* Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.checker.PropertyChecks;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.DisplayMode;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class FederationHeaderView.
*/
public class FederationHeaderView
{
private static Logger logger = LoggerFactory.getLogger(FederationHeaderView.class);
/**
* Htmlize.
*
* @param federation
* the federation
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Federation federation) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
data.setAttribute("federationLogo", "src", federation.getLogoFileName());
data.setEscapedContent("federationName", federation.getName());
data.setEscapedContent("federationDescription", federation.getDescription());
if (federation.getWebsiteURL() != null)
{
data.setEscapedContent("federationURL", federation.getWebsiteURL().toString());
data.setEscapedAttribute("federationURL", "href", federation.getWebsiteURL().toString());
}
data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDateValue(), "n/a"));
data.setAttribute("organizationsLink", "href", federation.getTechnicalName() + "-organizations.xhtml");
data.setAttribute("servicesLink", "href", federation.getTechnicalName() + "-services.xhtml");
data.setAttribute("rawLink", "href", federation.getTechnicalName() + ".properties");
data.setAttribute("propertyCheckLink", "href", federation.getTechnicalName() + "-propertycheck.xhtml");
data.setAttribute("statsLink", "href", federation.getTechnicalName() + "-stats.xhtml");
data.setAttribute("metricsLink", "href", federation.getTechnicalName() + "-metrics-summary-months-last.xhtml");
data.setAttribute("figuresLink", "href", federation.getTechnicalName() + "-services-figures.xhtml");
data.setAttribute("crawlLink", "href", federation.getTechnicalName() + "-crawl.xhtml");
data.setAttribute("uptimeLink", "href", federation.getLocalFileBaseName() + "-uptimes.xhtml");
if (HtmlizerContext.instance().getUptimeJournal().hasRecentError(federation.getActiveServices()))
{
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ko-mono.svg");
}
else
{
data.setAttribute("uptimeLinkImg", "src", "circle-icons/countdown-ok-mono.svg");
}
if (federation.getCrawlJournal().getErrors().isEmpty())
{
data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
}
else
{
data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
}
{
PropertyChecks checks = federation.getInputChecksAll();
data.setContent("errorCount", checks.getErrorCount());
data.setContent("warningCount", checks.getWarningCount());
data.setContent("voidCount", checks.getVoidCount());
data.setAttribute("alertLink", "href", federation.getTechnicalName() + "-propertyalerts.xhtml");
}
if (federation.getLegalURL() != null)
{
data.setEscapedAttribute("legalLink", "href", federation.getLegalURL().toString());
data.setAttribute("legalLinkImg", "class", "");
data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
}
if (federation.getContactURL() != null)
{
data.setEscapedAttribute("contactLink", "href", federation.getContactURL().toString());
data.setAttribute("contactLinkImg", "class", "");
data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
}
if (StringUtils.isNotBlank(federation.getContactEmail()))
{
data.setEscapedAttribute("emailLink", "href", "mailto:" + federation.getContactEmail());
data.setAttribute("emailLinkImg", "class", "");
data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
}
if (federation.getUserGuideURL() != null)
{
data.setEscapedAttribute("userDocLink", "href", federation.getUserGuideURL().toString());
data.setAttribute("userDocLinkImg", "class", "");
data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
}
if (federation.getTechnicalGuideURL() != null)
{
data.setEscapedAttribute("technicalDocLink", "href", federation.getTechnicalGuideURL().toString());
data.setAttribute("technicalDocLinkImg", "class", "");
data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
}
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml", data).toString();
result = XidynUtils.extractBodyContent(content);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation header view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,101 @@
/*
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class FederationMetricsPage.
*/
public class FederationMetricGenericPage
{
private static Logger logger = LoggerFactory.getLogger(FederationMetricGenericPage.class);
/**
* Builds the.
*
* @param htmlizeDirectory
* the htmlize directory
* @param federation
* the federation
* @param view
* the view
* @param period
* the period
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
{
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", FederationHeaderView.htmlize(federation));
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.GENERIC, view, period));
//
FederationMetricHtmlizer.htmlize(data, "graphic.users", federation, view, period, "metrics.service.users", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv4-ipv6", federation, view, period, "service.users (ipv4 + ipv6)", "metrics.service.users.ipv4", ChartColor.YELLOW,
"metrics.service.users.ipv6", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv4", federation, view, period, "metrics.service.users.ipv4", ChartColor.YELLOW);
FederationMetricHtmlizer.htmlize(data, "graphic.users.ipv6", federation, view, period, "metrics.service.users.ipv6", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.accounts", federation, view, period, "metrics.service.accounts", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.accounts.active", federation, view, period, "metrics.service.accounts.active", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.database.bytes", federation, view, period, "metrics.service.database.bytes", ChartColor.GREEN);
FederationMetricHtmlizer.htmlize(data, "graphic.datafiles.bytes", federation, view, period, "metrics.service.datafiles.bytes", ChartColor.GREEN);
//
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricGenericView.xhtml", data).toString();
//
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics génériques");
String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
}
}
}

View file

@ -0,0 +1,192 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.time.YearMonth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.threeten.extra.YearWeek;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
import fr.devinsy.statoolinfos.htmlize.charts.ChartColor;
import fr.devinsy.statoolinfos.htmlize.charts.MonthValues;
import fr.devinsy.statoolinfos.htmlize.charts.WeekValues;
import fr.devinsy.statoolinfos.htmlize.charts.YearValues;
import fr.devinsy.xidyn.data.TagDataManager;
/**
* The Class MetricHtmlizeDataUtils.
*/
public class FederationMetricHtmlizer
{
private static Logger logger = LoggerFactory.getLogger(FederationMetricHtmlizer.class);
/**
* Htmlize data.
*
* @param data
* the data
* @param metricId
* the metric id
* @param federation
* the federation
* @param view
* the view
* @param period
* the period
* @param metricPath
* the metric path
* @param color
* the color
* @throws StatoolInfosException
* the statool infos exception
*/
public static void htmlize(final TagDataManager data, final String metricId, final Federation federation, final ViewMenu view, final PeriodMenu period, final String metricPath,
final ChartColor color) throws StatoolInfosException
{
if (view == ViewMenu.YEARS)
{
YearValues yearMetric = federation.getMetricYearValuesAll(metricPath);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, yearMetric, color));
}
}
else if (view == ViewMenu.MONTHS)
{
MonthValues monthMetric = federation.getMetricMonthValuesAll(metricPath);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, monthMetric, color));
}
else if (period == PeriodMenu.LAST)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.now().minusMonths(11), YearMonth.now(), monthMetric, color));
}
else
{
int year = Integer.parseInt(period.name().substring(1));
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearMonth.of(year, 01), YearMonth.of(year, 12), monthMetric, color));
}
}
else if (view == ViewMenu.WEEKS)
{
WeekValues weekMetric = federation.getMetricWeekValuesAll(metricPath);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(null, null, weekMetric, color));
}
else if (period == PeriodMenu.LAST)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.now().minusYears(1), YearWeek.now(), weekMetric, color));
}
else
{
int year = Integer.parseInt(period.name().substring(1));
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(YearWeek.of(year, 01), YearWeek.of(year, 53), weekMetric, color));
}
}
}
/**
* Htmlize.
*
* @param data
* the data
* @param metricId
* the metric id
* @param federation
* the federation
* @param view
* the view
* @param period
* the period
* @param metricLabel
* the metric label
* @param metricPath1
* the metric path 1
* @param color1
* the color 1
* @param metricPath2
* the metric path 2
* @param color2
* the color 2
* @throws StatoolInfosException
* the statool infos exception
*/
public static void htmlize(final TagDataManager data, final String metricId, final Federation federation, final ViewMenu view, final PeriodMenu period, final String metricLabel,
final String metricPath1, final ChartColor color1, final String metricPath2, final ChartColor color2) throws StatoolInfosException
{
if (view == ViewMenu.YEARS)
{
YearValues yearMetric1 = federation.getMetricYearValuesAll(metricPath1);
YearValues yearMetric2 = federation.getMetricYearValuesAll(metricPath2);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, yearMetric1, yearMetric2));
}
}
else if (view == ViewMenu.MONTHS)
{
//
MonthValues monthMetric1 = federation.getMetricMonthValuesAll(metricPath1);
MonthValues monthMetric2 = federation.getMetricMonthValuesAll(metricPath2);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
}
else if (period == PeriodMenu.LAST)
{
data.setContent(metricId,
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.now().minusMonths(11), YearMonth.now(), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
}
else
{
int year = Integer.parseInt(period.name().substring(1));
data.setContent(metricId,
ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearMonth.of(year, 01), YearMonth.of(year, 12), new ChartColor[] { color1, color2 }, monthMetric1, monthMetric2));
}
}
else if (view == ViewMenu.WEEKS)
{
WeekValues weekMetric1 = federation.getMetricWeekValuesAll(metricPath1);
WeekValues weekMetric2 = federation.getMetricWeekValuesAll(metricPath2);
if (period == PeriodMenu.FULL)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, null, null, new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
}
else if (period == PeriodMenu.LAST)
{
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.now().minusYears(1), YearWeek.now(), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
}
else
{
int year = Integer.parseInt(period.name().substring(1));
data.setContent(metricId, ChartHtmlizer.htmlizeMetricsChart(metricLabel, YearWeek.of(year, 01), YearWeek.of(year, 53), new ChartColor[] { color1, color2 }, weekMetric1, weekMetric2));
}
}
}
}

View file

@ -0,0 +1,264 @@
/*
* Copyright (C) 2021-2023 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.util.ArrayList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class OrganizationMetricMenuView.
*/
public class FederationMetricMenuView
{
private static Logger logger = LoggerFactory.getLogger(FederationMetricMenuView.class);
public enum PeriodMenu
{
FULL,
LAST,
Y2021,
Y2022;
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
String result;
if (this.name().startsWith("Y"))
{
result = this.name().substring(1);
}
else
{
result = this.name().toLowerCase();
}
//
return result;
}
/**
* Gets the years.
*
* @return the years
*/
public static PeriodMenu[] getYears()
{
PeriodMenu[] result;
ArrayList<PeriodMenu> list = new ArrayList<PeriodMenu>();
for (PeriodMenu item : values())
{
if (item.name().startsWith("Y"))
{
list.add(item);
}
}
result = list.toArray(new PeriodMenu[0]);
//
return result;
}
}
public enum TypeMenu
{
SUMMARY,
WEB,
GENERIC,
SPECIFIC;
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
String result;
result = this.name().toLowerCase();
//
return result;
}
}
public enum ViewMenu
{
YEARS,
MONTHS,
WEEKS,
DAYS;
/**
* Gets the name.
*
* @return the name
*/
public String getName()
{
String result;
result = this.name().toLowerCase();
//
return result;
}
}
/**
* Htmlize.
*
* @param federation
* the service
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Federation federation, final TypeMenu type, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
//
String filename = String.format("%s-metrics-summary-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
data.setAttribute("summaryTypeButton", "href", filename);
filename = String.format("%s-metrics-generic-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
data.setAttribute("genericTypeButton", "href", filename);
filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
data.setAttribute("specificTypeButton", "href", filename);
filename = String.format("%s-metrics-web-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
data.setAttribute("webTypeButton", "href", filename);
//
filename = String.format("%s-metrics-%s-years-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), PeriodMenu.FULL.getName());
data.setAttribute("yearsViewButton", "href", filename);
filename = String.format("%s-metrics-%s-months-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), period.getName());
data.setAttribute("monthsViewButton", "href", filename);
filename = String.format("%s-metrics-%s-weeks-%s.xhtml", federation.getLocalFileBaseName(), type.getName(), period.getName());
data.setAttribute("weeksViewButton", "href", filename);
data.setAttribute("daysViewButton", "href", "#");
//
filename = String.format("%s-metrics-%s-%s-full.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
data.setAttribute("fullPeriodButton", "href", filename);
if (view != ViewMenu.YEARS)
{
filename = String.format("%s-metrics-%s-%s-last.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
data.setAttribute("lastPeriodButton", "href", filename);
filename = String.format("%s-metrics-%s-%s-2021.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
data.setAttribute("2021PeriodButton", "href", filename);
filename = String.format("%s-metrics-%s-%s-2022.xhtml", federation.getLocalFileBaseName(), type.getName(), view.getName());
data.setAttribute("2022PeriodButton", "href", filename);
}
//
if ((type == null) || (type == TypeMenu.SUMMARY))
{
data.appendAttribute("summaryTypeButton", "class", "button selected");
}
else if (type == TypeMenu.GENERIC)
{
data.appendAttribute("genericTypeButton", "class", "button selected");
}
else if (type == TypeMenu.WEB)
{
data.appendAttribute("webTypeButton", "class", "button selected");
}
else if (type == TypeMenu.SPECIFIC)
{
data.appendAttribute("specificTypeButton", "class", "button selected");
}
//
if ((view == null) || (view == ViewMenu.YEARS))
{
data.appendAttribute("yearsViewButton", "class", "button selected");
}
else if (view == ViewMenu.MONTHS)
{
data.appendAttribute("monthsViewButton", "class", "button selected");
}
else if (view == ViewMenu.WEEKS)
{
data.appendAttribute("weeksViewButton", "class", "button selected");
}
else if (view == ViewMenu.DAYS)
{
data.appendAttribute("daysViewButton", "class", "button selected");
}
//
if ((period == null) || (period == PeriodMenu.FULL))
{
data.appendAttribute("fullPeriodButton", "class", "button selected");
}
else if (period == PeriodMenu.LAST)
{
data.appendAttribute("lastPeriodButton", "class", "button selected");
}
else if (period == PeriodMenu.Y2021)
{
data.appendAttribute("2021PeriodButton", "class", "button selected");
}
else if (period == PeriodMenu.Y2022)
{
data.appendAttribute("2022PeriodButton", "class", "button selected");
}
//
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml", data).toString();
result = XidynUtils.extractBodyContent(content);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building metric menu view: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
* StatoolInfos 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.
*
* StatoolInfos 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 StatoolInfos. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.devinsy.statoolinfos.htmlize;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.TypeMenu;
import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class FederationMetricsPage.
*/
public class FederationMetricSpecificPage
{
private static Logger logger = LoggerFactory.getLogger(FederationMetricSpecificPage.class);
/**
* Builds the.
*
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException
{
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", FederationHeaderView.htmlize(federation));
data.setContent("metricMenuView", FederationMetricMenuView.htmlize(federation, TypeMenu.SPECIFIC, view, period));
//
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceMetricSummaryView.xhtml", data).toString();
//
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Metrics spécifiques");
String page = WebCharterView.build(content, trail);
String filename = String.format("%s-metrics-specific-%s-%s.xhtml", federation.getLocalFileBaseName(), view.getName(), period.getName());
FileUtils.write(new File(htmlizeDirectory, filename), page, StandardCharsets.UTF_8);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation metrics page: " + exception.getMessage(), exception);
}
}
}

Some files were not shown because too many files have changed in this diff Show more