Compare commits
153 commits
0.5.1-SNAP
...
main
Author | SHA1 | Date | |
---|---|---|---|
c414a04075 | |||
000d779d01 | |||
b092073311 | |||
c330ac064d | |||
35a90e3ff9 | |||
3ace8b3151 | |||
0af4eafec3 | |||
e8a96d1bcb | |||
9662d66254 | |||
93284171d9 | |||
3740992dd1 | |||
613d3891be | |||
9caa833856 | |||
6455fc7e90 | |||
3fcb303a91 | |||
856aab30c9 | |||
0526ab46e8 | |||
790f40b9e7 | |||
4c0fc7d6a5 | |||
d960265a0b | |||
8ca626039a | |||
2ab08cca77 | |||
f11b3c7ec3 | |||
839689e6c6 | |||
b9f67d8363 | |||
eca3d45fb6 | |||
d024d02409 | |||
cfec6aab7c | |||
f98a53362e | |||
f0f915ddc1 | |||
e44bda8db2 | |||
93c06e728a | |||
6bf7610328 | |||
b5cfdaef21 | |||
be08c8c7e4 | |||
9227238b25 | |||
78e6fda4cc | |||
9bd442d99f | |||
f32c712727 | |||
33455ae54f | |||
3ca13aad0c | |||
b37cebb01f | |||
98966ee8ea | |||
0f67780f1b | |||
112afd61ed | |||
1253e22ce1 | |||
d453979eef | |||
633246dddd | |||
f1074afe95 | |||
70f6c9fb02 | |||
4612402014 | |||
a4f968a347 | |||
3bc224b779 | |||
cc545c217e | |||
080f72a374 | |||
ed2590b88b | |||
623438a218 | |||
8564cef205 | |||
7af1766f4f | |||
da1af17b04 | |||
0458382f86 | |||
02281b1ab6 | |||
8619c59a65 | |||
c51822877f | |||
00486a4710 | |||
5e7ec3e6f2 | |||
189f8471ac | |||
8b972d3fce | |||
805144c2cf | |||
bb1820222f | |||
52090b3637 | |||
3565c1024b | |||
72ea872546 | |||
5cc3f8c634 | |||
607135b72e | |||
9d35f87009 | |||
ea85018977 | |||
4a0ac7b2df | |||
c1adf8e650 | |||
f28e0e61aa | |||
a0ba83b885 | |||
2ec1b2e926 | |||
af0ee48e4b | |||
89bb16ea66 | |||
2b5fb4489b | |||
1539872bf2 | |||
8fdafcdf1d | |||
580d2ff447 | |||
ad7494c01f | |||
ec9f8ede3c | |||
72483be914 | |||
0555c41c10 | |||
9a1b76343e | |||
96c31990d0 | |||
d7fad84d11 | |||
10b284c053 | |||
a1dd2ba48f | |||
67445f6170 | |||
5080c980d8 | |||
b1d46f61a6 | |||
c79e9ade15 | |||
9d63f37e33 | |||
bb2e551196 | |||
f69847abb9 | |||
6245ef8c5a | |||
84d073ab8e | |||
4ec7e4de81 | |||
5521dcaec5 | |||
a977b16b3c | |||
14217d74be | |||
4c2869862f | |||
89b56c543e | |||
9970a85bff | |||
dcc266a41d | |||
999b61d3be | |||
3e328d186c | |||
34550c8ab4 | |||
d309c4156a | |||
a6ddce2ee1 | |||
c8b63869b2 | |||
003fb306a0 | |||
a1e9949ca5 | |||
83efaf25e7 | |||
3cd843e1f1 | |||
c98fc07e1b | |||
92f6674bfc | |||
04aed10a38 | |||
8712c99894 | |||
f23834d8e3 | |||
a414ba7956 | |||
7b77a0ddf6 | |||
edc60840d0 | |||
fbf6e50b49 | |||
4d6e592204 | |||
e034f955ad | |||
fa053bebad | |||
371d199ee9 | |||
b8433e84eb | |||
62f1b7b92f | |||
a1833ddd0b | |||
611b962171 | |||
af44628def | |||
32972d2046 | |||
70387d3cfd | |||
03d7661ba9 | |||
7533d0cd43 | |||
c2076f15ce | |||
5601fe5d54 | |||
0b44e9629e | |||
c858a23e0d | |||
950d06fae7 | |||
058b902fbd | |||
bca355a047 |
491 changed files with 13717 additions and 26957 deletions
23
.classpath
23
.classpath
|
@ -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-11">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
|
@ -18,19 +18,28 @@
|
|||
<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
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
/build
|
||||
/dist
|
||||
*~
|
||||
/.apt_generated/
|
||||
|
|
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
|
@ -0,0 +1,2 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
5
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
5
.settings/org.eclipse.jdt.apt.core.prefs
Normal file
|
@ -0,0 +1,5 @@
|
|||
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
|
|
@ -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=11
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.compliance=17
|
||||
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,20 +21,30 @@ 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=11
|
||||
org.eclipse.jdt.core.compiler.source=17
|
||||
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
|
||||
|
@ -44,6 +54,8 @@ 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
|
||||
|
@ -52,6 +64,7 @@ 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
|
||||
|
@ -62,8 +75,10 @@ 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
|
||||
|
@ -112,6 +127,7 @@ 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
|
||||
|
@ -191,6 +207,7 @@ 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
|
||||
|
@ -282,6 +299,7 @@ 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
|
||||
|
@ -365,6 +383,8 @@ 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
|
||||
|
@ -395,6 +415,7 @@ 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
|
||||
|
@ -404,5 +425,6 @@ 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
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
cleanup.add_all=false
|
||||
cleanup.add_default_serial_version_id=false
|
||||
cleanup.add_generated_serial_version_id=true
|
||||
cleanup.add_missing_annotations=true
|
||||
|
@ -7,34 +8,78 @@ 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
|
||||
|
@ -47,13 +92,36 @@ 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
|
||||
|
@ -61,18 +129,22 @@ 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_profile=_StatoolInfos
|
||||
cleanup.useless_continue=false
|
||||
cleanup.useless_return=false
|
||||
cleanup.valueof_rather_than_instantiation=false
|
||||
cleanup_profile=_StaoolInfos
|
||||
cleanup_settings_version=2
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
formatter_profile=_StatoolInfos
|
||||
formatter_settings_version=19
|
||||
formatter_settings_version=23
|
||||
jautodoc.cleanup.add_header=false
|
||||
jautodoc.cleanup.javadoc=false
|
||||
jautodoc.cleanup.replace_header=false
|
||||
|
@ -80,6 +152,8 @@ 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
|
||||
|
@ -89,35 +163,79 @@ 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
|
||||
|
@ -130,13 +248,36 @@ 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
|
||||
|
@ -144,12 +285,16 @@ 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
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="SikevaDB">
|
||||
|
||||
<wb-module deploy-name="StatooInfos">
|
||||
|
||||
<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>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?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="11"/>
|
||||
<installed facet="java" version="17"/>
|
||||
</faceted-project>
|
||||
|
|
164
CHANGELOG.md
Normal file
164
CHANGELOG.md
Normal file
|
@ -0,0 +1,164 @@
|
|||
# StatoolInfos Changelog
|
||||
|
||||
All notable changes of StatoolInfos will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- …
|
||||
|
||||
## [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
|
||||
|
||||
Changes for metrics:
|
||||
- Added multi sources for Http log file search.
|
||||
- Added wrong password metrics for Minetest.
|
||||
- Fixed property label in Privatebin patch probe.
|
||||
- Added CLI commands to test HttpAccessLog files and lines.
|
||||
- Moved HttpErrorLog analyzer in dedicated package.
|
||||
- Refactored prober call from CLI.
|
||||
- Added new metrics analyzers.
|
||||
- Added pathFilter parameter in httpAccessLog read.
|
||||
- Fixed HTTP access log pattern.
|
||||
- Fixed HTTP pattern management from metric conf file.
|
||||
- Added Kuma in Bot detection file.
|
||||
- Added not authorized HTTP status code.
|
||||
- Added chat metrics for Minetest.
|
||||
- Set 401 uptime case as OK.
|
||||
- Improved bot pattern list with TinyStatus.
|
||||
- Added metrics for GSL.
|
||||
- Improved documentation (README)
|
||||
|
||||
Changes for web building:
|
||||
- Improved property stats page with only active organizations.
|
||||
- Improved PropertyStats page with only active services.
|
||||
- Fixed hosting properties file management.
|
||||
- Added Z support in DATETIME property check.
|
||||
- Added optional parameter IPV6ONLY in statoolinfos.sh.
|
||||
- Changed metrics menu entry from 2020 to 2022.
|
||||
- Fixed bad category list building.
|
||||
- Removed debug trace.
|
||||
- Fixed categories compare.
|
||||
- Fixed wording.
|
||||
- Fixed separate case characters in property stats.
|
||||
- Improved federation service count.
|
||||
- Improved date management.
|
||||
- Improved startDate and endDate management for services.
|
||||
- Improved startDate and endDate management for organizations.
|
||||
- Improved Federation getStartDate management.
|
||||
- Added provider hypervisor charts for service stats.
|
||||
- Added type chart and provider hypervisor charts for organization stats.
|
||||
- Added federation organization type chart. Improved federation charts.
|
||||
- Refactored federation stats. Added provider hypervisor chart.
|
||||
- Added organization.type check entry.
|
||||
- Added host.provider.hypervisor check entry.
|
||||
- Changed color of ServiceCountYearChart.
|
||||
- Fixed bad display of htmlizeHostNamePieChart.
|
||||
- Swap columns in htmlizeOrganizationInOutChart.
|
||||
- Fixed colors.
|
||||
|
||||
|
||||
## [0.5.0] – 2022-01-23
|
||||
|
||||
This release contains many improvments:
|
||||
- Extended http access log regex.
|
||||
- Restricted federation stats to active organizations only.
|
||||
- Improved status management in organizations and services display.
|
||||
- Added Let's encrypt detection for bot filtering.
|
||||
- Added date tips in header column with monthly label.
|
||||
- Replaced 0 value with emoji in organizations view and services view.
|
||||
- Added visits.ipv4 and visits.ipv6 management.
|
||||
- Added metrics configuration templates in README.
|
||||
- Changed visit and visitor definition.
|
||||
- Fixed bug in error nginx time parsing.
|
||||
- Fixed label display in 2 data graph.
|
||||
- Added bot pattern for mod_jk dummy connection in http logs.
|
||||
- Added asterisk month in organization list view.
|
||||
- Added asterisk month in service list view.
|
||||
- Fixed DataTables paths.
|
||||
- Fixed former member display.
|
||||
- Improved userAgent analyze.
|
||||
- Fixed empty http log file bug.
|
||||
- Added first veresion of Mumble probing (see README.md).
|
||||
- Fixed bug in TimeMark code.
|
||||
- Added first version of PrivateBin probing (see README.md).
|
||||
- Migrated to Log4j2 (with Log4shell fix).
|
||||
- Made code improvments.
|
||||
|
||||
Warning: visit and visitors definition has changed. Now it is more restricted: humans + method GET + page + status SUCCESS.
|
||||
|
||||
So some metrics have to be generate again (with -full) and some properties have to deleted:
|
||||
- Added
|
||||
- metrics.http.requesters : nombre de requêteurs.
|
||||
- metrics.http.requesters.ipv4 : nombre de requêteurs IPv4.
|
||||
- metrics.http.requesters.ipv6 : nombre de requêteurs IPv6.
|
||||
- metrics.http.requesters.humans : nombre de requêteurs humains.
|
||||
- metrics.http.requesters.bots : nombre de requêteurs bots.
|
||||
- metrics.http.requesters.bots.walks : nombre de passages de requêteurs bots.
|
||||
- metrics.http.metrics.methods.XXX : nombre de requête avec la méthode XXX.
|
||||
- metrics.http.visits.ipv4 : nombre de visites en IPv4.
|
||||
- metrics.http.visits.ipv6 : nombre de visites en IPv6.
|
||||
- Changed
|
||||
- metrics.http.visits : définition plus restrictive (humains + GET + page + SUCCESS).
|
||||
- metrics.http.visitors : définition de visiteur plus restrictive.
|
||||
- metrics.http.visitors.ipv4 : définition de visiteur plus restrictive.
|
||||
- metrics.http.visitors.ipv6 : définition de visiteur plus restrictive.
|
||||
- Removed
|
||||
- metrics.http.visitors.humans : remplacé par metrics.http.visitors (nouvelle définition d'une visite).
|
||||
- metrics.http.visitors.bots : supprimé (nouvelle définition d'une visite).
|
||||
- metrics.https.visits.bots : supprimé (nouvelle définition d'une visite).
|
||||
|
||||
## [0.4.1] – 2021-12-23
|
||||
|
||||
This release contains small improvments:
|
||||
- Fixed DataTables (CVE-2021-23445).
|
||||
- Improved wildcard feature in probe command (#1 thx Kepon).
|
||||
- Improved sample config file.
|
||||
- Added beta Minetest specific probing feature.
|
||||
|
||||
## [0.4.0] – 2021-12-15
|
||||
|
||||
This release contains probe feature to generate metrics files.
|
339
README.md
339
README.md
|
@ -10,6 +10,7 @@ StatoolInfos is released under the GNU AGPL+ license. Enjoy!
|
|||
Authors:
|
||||
* Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||
|
||||
Contributors : Angie, MrFlos, Quentin Duchemin, Fabrice61, Thomas TConstans, labecasse, Antoine Jaba, setop, Jérémy Collot, Pilou, Kepon, Laurent Sleto, Rodinux…
|
||||
|
||||
### Cat Avatar Generator images
|
||||
|
||||
|
@ -19,28 +20,17 @@ 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.
|
||||
|
||||
### Cicle-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
|
||||
|
||||
Author: Christian Pierre MOMON <christian.momon@devinsy.fr>
|
||||
|
||||
License: Creative Commons CC-BY-SA last version.
|
||||
License: Creative Commons CC BY-SA last version.
|
||||
|
||||
|
||||
### Other stuff
|
||||
|
||||
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+.
|
||||
License of other stuff: without any specific information, default license of images is CC BY-SA 3+.
|
||||
|
||||
|
||||
## DOCUMENTATION
|
||||
|
@ -49,20 +39,48 @@ Read CONCEPT.md and ONTOLOGY.md files.
|
|||
|
||||
## Requirements
|
||||
|
||||
- Java 11
|
||||
- Eclipse 4.16 (202006).
|
||||
- Java 17
|
||||
- Eclipse 4.29 (2023-09).
|
||||
|
||||
## INSTALL
|
||||
|
||||
Install Java :
|
||||
Install Java on Debian:
|
||||
|
||||
```
|
||||
apt-get install openjdk-11-jre-headless
|
||||
apt-get install openjdk-17-jre-headless
|
||||
```
|
||||
|
||||
Download the last release: https://forge.devinsy.fr/devinsy/statoolinfos/releases
|
||||
Download the last release: `https://forge.devinsy.fr/statool/statoolinfos/releases` and unzip the package.
|
||||
|
||||
Unzip the package and move the `statoolinfos.jar` and `statoolinfo.sh` files in `/srv/statoolinfos/bin/`.
|
||||
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/`.
|
||||
|
||||
Create link:
|
||||
|
||||
|
@ -70,6 +88,15 @@ 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
|
||||
|
||||
|
@ -81,25 +108,182 @@ Usage:
|
|||
statoolinfos build <configurationfile> build property files from conf and input
|
||||
statoolinfos clear <configurationfile> remove property files from conf
|
||||
statoolinfos crawl <configurationfile> crawl all file from conf and input
|
||||
statoolinfos htmlize <configurationfile> generate web pages from conf
|
||||
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 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
|
||||
statoolinfos uptime <configurationfile> update uptime journal
|
||||
|
||||
statoolinfos format <fileordirectory> format property files in tiny way
|
||||
statoolinfos list ip [-bot|-nobot] <fileordirectory> generate ip list from log file
|
||||
statoolinfos list ua [-bot|-nobot] <fileordirectory> generate user agent list from log file
|
||||
statoolinfos list visitors [-bot|-nobot] <fileordirectory> generate visitors (ip+ua) list from log file
|
||||
statoolinfos stat ip [-bot|-nobot] <fileordirectory> generate stats about ip from log file
|
||||
statoolinfos stat ua [-bot|-nobot] <fileordirectory> generate stats about user agent from log file
|
||||
statoolinfos stat visitors [-bot|-nobot] <fileordirectory> generate stats about visitors (ip+ua) from log file
|
||||
statoolinfos tagdate <fileordirectory> update the file.datetime file
|
||||
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
|
||||
```
|
||||
|
||||
|
||||
## Generate metrics files
|
||||
## Htmlize command **removed**
|
||||
|
||||
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
|
||||
|
||||
Create a configuration file `/srv/statoolInfos/conf/foo.bar.org.conf`:
|
||||
|
||||
|
@ -118,15 +302,40 @@ Generate the metric file for the first time:
|
|||
/srv/statoolinfos/bin/statoolinfos probe -full /srv/statoolinfos/conf/foo.bar.org.conf
|
||||
```
|
||||
|
||||
Create a cron file to update the metric file everyday:
|
||||
|
||||
Create a cron file in `/etc/cron.d/statoolinfos` to update the metric file everyday:
|
||||
```
|
||||
1 * * * * root /srv/statoolinfos/bin/probe -previousday /srv/statoolinfos/conf/foo.bar.org.conf
|
||||
4 0,12 * * * root /srv/statoolinfos/bin/statoolinfos probe -previousday /srv/statoolinfos/conf/foo.bar.org.conf >> /srv/statoolinfos/cron.log
|
||||
```
|
||||
|
||||
Warning: in previous day mode, the metrics generated are overwrited for the last month, the last week and the last day. So, six weeks in logs are required.
|
||||
In case of several configuration files, just set the configuration directory (without wildcard):
|
||||
```
|
||||
1 0,12 * * * root /srv/statoolinfos/bin/statoolinfos probe -previousday /srv/statoolinfos/conf/ >> /srv/statoolinfos/cron.log
|
||||
```
|
||||
|
||||
Warning: in previous day mode, the metrics generated are overwrited for the last month, the last week and the last day. So, **six weeks in logs are required**.
|
||||
|
||||
|
||||
### Etherpad metrics
|
||||
|
||||
Configuration template:
|
||||
|
||||
```
|
||||
conf.probe.types=Etherpad
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httpaccesslog.pattern=
|
||||
conf.probe.httpaccesslog.pathfilter=
|
||||
# This parameter requires real ip proxy setting and log output setting.
|
||||
conf.probe.etherpad.logs=/var/log/etherpad/output.log
|
||||
# Database URL. Example of the most frequent cases:
|
||||
# jdbc:mariadb://localhost:1234/databasename
|
||||
# jdbc:mysql://localhost:1234/databasename
|
||||
# jdbc:postgresql://localhost:1234/databasename
|
||||
# jdbc:sqlite:/foo/bar/databasename.sqlite
|
||||
conf.probe.etherpad.database.url=
|
||||
conf.probe.etherpad.database.user=
|
||||
conf.probe.etherpad.database.password=
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
```
|
||||
|
||||
### Framdadate metrics (coming soon)
|
||||
|
||||
|
@ -145,6 +354,7 @@ Configuration template:
|
|||
conf.probe.types=Gitea
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httpaccesslog.pattern=
|
||||
conf.probe.httpaccesslog.pathfilter=
|
||||
conf.probe.gitea.data=/opt/gitea/data
|
||||
conf.probe.gitea.api.url=https://forge.libre-service.eu/
|
||||
conf.probe.gitea.token=b6598c616b1cd350b834258205da4e5e8b951005
|
||||
|
@ -158,7 +368,7 @@ conf.probe.gitea.database.password=
|
|||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
```
|
||||
|
||||
### LibreQR metrics (coming soon)
|
||||
### LibreQR metrics
|
||||
|
||||
Configuration template:
|
||||
|
||||
|
@ -166,6 +376,7 @@ Configuration template:
|
|||
conf.probe.types=LibreQR
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httpaccesslog.pattern=
|
||||
conf.probe.httpaccesslog.pathfilter=
|
||||
conf.probe.libreqr.datafiles=/var/www/foo.bar.org/temp/
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
```
|
||||
|
@ -208,10 +419,11 @@ Configuration template:
|
|||
conf.probe.types=Nextcloud
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httpaccesslog.pattern=
|
||||
conf.probe.httpaccesslog.pathfilter=
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
```
|
||||
|
||||
### PrivateBin metrics (experimental)
|
||||
### PrivateBin metrics (partial)
|
||||
|
||||
Warning: works fine if database, image and comment options are disabled.
|
||||
|
||||
|
@ -221,6 +433,7 @@ Configuration template:
|
|||
conf.probe.types=PrivateBin
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httpaccesslog.pattern=
|
||||
conf.probe.httpaccesslog.pathfilter=
|
||||
conf.probe.privatebin.data=/var/www/paste.libre-service.eu/data/
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
```
|
||||
|
@ -231,11 +444,61 @@ Configuration template:
|
|||
|
||||
```
|
||||
conf.probe.types=HttpAccessLog, HttpErrorLog
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*
|
||||
conf.probe.httperrorlog.file=/var/log/apache2/foo.bar.org-error.log*
|
||||
conf.probe.httpaccesslog.file=/var/log/apache2/foo.bar.org-access.log*,/var/log/apache2/foo.bar.org-extraaccess.log*
|
||||
conf.probe.httperrorlog.file=/var/log/apache2/foo.bar.org-error.log*,/var/log/apache2/foo.bar.org-extraerror.log*
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/foo.bar.org-metrics.properties
|
||||
|
||||
# Custom access log pattern with Java regex.
|
||||
# Default: "^(?<remoteAddress>[a-zA-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
|
||||
missingok
|
||||
rotate 7
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
<!-- ***** 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>
|
||||
|
@ -124,16 +126,22 @@
|
|||
|
||||
|
||||
<!-- 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" 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"/>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Sun Jan 23 03:49:04 CET 2022
|
||||
build.number=1
|
||||
#Mon Sep 23 04:40:53 CEST 2024
|
||||
build.number=2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
product.name=statoolinfos
|
||||
product.revision.major=0
|
||||
product.revision.minor=5
|
||||
product.revision.minor=6
|
||||
product.revision.snapshot=
|
||||
|
|
117
build.sh
117
build.sh
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
function help
|
||||
{
|
||||
echo "StatoolInfos build script."
|
||||
echo "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
|
|||
}
|
||||
|
||||
#
|
||||
# Build snapshot.
|
||||
# Check env.
|
||||
#
|
||||
function build_snapshot
|
||||
function check_env
|
||||
{
|
||||
okCount=0
|
||||
|
||||
|
@ -40,96 +40,13 @@ function build_snapshot
|
|||
fi
|
||||
|
||||
# Java version check.
|
||||
JAVA_VERSION=17;
|
||||
javaVersionCheck=`javac -version 2>&1`
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
|
||||
echo "Java 11 version requirement..... OK"
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ ${JAVA_VERSION}. ]]; then
|
||||
echo "Java ${JAVA_VERSION} version requirement..... OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
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"
|
||||
echo "Java ${JAVA_VERSION} version requirement..... MISSING"
|
||||
fi
|
||||
|
||||
# Git check.
|
||||
|
@ -143,26 +60,28 @@ function build_tagandpush
|
|||
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/log4j-api-2.23.1-sources.jar
Normal file
BIN
lib/Logs/log4j-api-2.23.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/Logs/log4j-api-2.23.1.jar
Normal file
BIN
lib/Logs/log4j-api-2.23.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/log4j-core-2.23.1-sources.jar
Normal file
BIN
lib/Logs/log4j-core-2.23.1-sources.jar
Normal file
Binary file not shown.
BIN
lib/Logs/log4j-core-2.23.1.jar
Normal file
BIN
lib/Logs/log4j-core-2.23.1.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/log4j-slf4j2-impl-2.23.1.jar
Normal file
BIN
lib/Logs/log4j-slf4j2-impl-2.23.1.jar
Normal file
Binary file not shown.
BIN
lib/Logs/log4j-slf4j2-impl-2.32.1-sources.jar
Normal file
BIN
lib/Logs/log4j-slf4j2-impl-2.32.1-sources.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/Logs/slf4j-api-2.0.16-sources.jar
Normal file
BIN
lib/Logs/slf4j-api-2.0.16-sources.jar
Normal file
Binary file not shown.
BIN
lib/Logs/slf4j-api-2.0.16.jar
Normal file
BIN
lib/Logs/slf4j-api-2.0.16.jar
Normal file
Binary file not shown.
|
@ -1,9 +1,10 @@
|
|||
Description of used libraries:
|
||||
|
||||
- Logs/
|
||||
- log4j log API
|
||||
- log4j-api log API
|
||||
- log4j-core
|
||||
- log4j-slf4j-impl adaptation layer between slf4j and log4j
|
||||
- slf4j-api facade log API
|
||||
- slf4j-log4j12 adaptation layer between slf4j and log4j
|
||||
|
||||
- UnitTesting/
|
||||
- hamcrest-core required by junit
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
resources/conf/README.md
Normal file
1
resources/conf/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
See the `srv/statoolinfos/conf` directory.
|
|
@ -1,14 +0,0 @@
|
|||
#
|
||||
# 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/
|
|
@ -1,3 +0,0 @@
|
|||
LANGUAGE=fr_FR.UTF8
|
||||
LC_ALL=fr_FR.UTF-8
|
||||
/5 * * * * root /srv/statoolinfos/bin/statoolinfo.sh >> /srv/statoolinfos/statoolinfos-cron.log
|
5
resources/etc/apache2/statoolinfos.conf
Normal file
5
resources/etc/apache2/statoolinfos.conf
Normal file
|
@ -0,0 +1,5 @@
|
|||
Alias "/.well-known/statoolinfos/" "/srv/statoolinfos/well-known/statoolinfos/"
|
||||
<Directory "/srv/statoolinfos/well-known/statoolinfos">
|
||||
Options +Indexes
|
||||
Require all granted
|
||||
</Directory>
|
2
resources/etc/cron.d/statoolinfos
Normal file
2
resources/etc/cron.d/statoolinfos
Normal file
|
@ -0,0 +1,2 @@
|
|||
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
|
|
@ -13,9 +13,10 @@ if [[ "$javaCheck" =~ ^/.* ]]; then
|
|||
# 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 $LOGFILE $LOGLEVEL -jar "$(dirname "$0")"/statoolinfos.jar $@
|
||||
java -Djava.awt.headless=true $IPV6ONLY $LOGFILE $LOGLEVEL -jar "$(dirname "$0")"/statoolinfos.jar $@
|
||||
else
|
||||
echo "Java requirement............... MISSING"
|
||||
fi
|
||||
|
|
7
resources/srv/statoolinfos/bin/crawl
Executable file
7
resources/srv/statoolinfos/bin/crawl
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/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
|
7
resources/srv/statoolinfos/bin/probe
Executable file
7
resources/srv/statoolinfos/bin/probe
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/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
|
10
resources/srv/statoolinfos/bin/refresh
Executable file
10
resources/srv/statoolinfos/bin/refresh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/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
|
22
resources/srv/statoolinfos/bin/statoolinfos.sh
Executable file
22
resources/srv/statoolinfos/bin/statoolinfos.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/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
|
7
resources/srv/statoolinfos/bin/uptime
Executable file
7
resources/srv/statoolinfos/bin/uptime
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/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
|
8
resources/srv/statoolinfos/conf/sample-federation.conf
Normal file
8
resources/srv/statoolinfos/conf/sample-federation.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
# [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/
|
||||
|
||||
|
8
resources/srv/statoolinfos/conf/sample-probe-http.conf
Normal file
8
resources/srv/statoolinfos/conf/sample-probe-http.conf
Normal file
|
@ -0,0 +1,8 @@
|
|||
# [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
|
|
@ -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=/home/cpm/Projets/StatoolInfos/EnvTest/minetest/test.metrics
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfo/www.myservice.org-metrics.properties
|
|
@ -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
|
||||
conf.probe.target=/srv/statoolinfos/well-known/statoolinfos/qrcode.libre-service.eu-metrics.properties
|
||||
|
||||
|
0
resources/srv/statoolinfos/statoolinfos-cron.log
Normal file
0
resources/srv/statoolinfos/statoolinfos-cron.log
Normal file
1
resources/srv/statoolinfos/well-known/statoolinfos/BOM
Normal file
1
resources/srv/statoolinfos/well-known/statoolinfos/BOM
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
# 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]
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
# 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]
|
|
@ -0,0 +1,163 @@
|
|||
# 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 d’amis, 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 =
|
|
@ -0,0 +1,43 @@
|
|||
# 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]
|
|
@ -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)
|
||||
|
|
1175
src/fr/devinsy/statoolinfos/app/StatoolInfosApp.java
Normal file
1175
src/fr/devinsy/statoolinfos/app/StatoolInfosApp.java
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -80,51 +80,106 @@ 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;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class PropertyChecker
|
|||
public static final String BOM = "\ufeff";
|
||||
public static final String COMMENT = "^#.*$";
|
||||
public static final String STRING = "^.+$";
|
||||
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d)?";
|
||||
public static final String DATETIME = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}([\\.,]\\d+)?)?([+-]\\d\\d:\\d\\d|Z)?";
|
||||
public static final String DATE = "^(\\d{4}-\\d{2}-\\d{2}|\\d{2}/\\d{2}/\\d{4}|\\d{2}/\\d{4})";
|
||||
public static final String URL = "^https?://[\\w-_\\.]+(\\.\\w+)+(:\\d+)?(/.*)?$";
|
||||
public static final String EMAIL = "^.*@.*$";
|
||||
|
@ -137,6 +137,7 @@ public class PropertyChecker
|
|||
this.organizationRules.add("organization.geolocation.latitude", DECIMAL_DEGREE, PropertyMode.OPTIONAL);
|
||||
this.organizationRules.add("organization.geolocation.longitude", DECIMAL_DEGREE, PropertyMode.OPTIONAL);
|
||||
this.organizationRules.add("organization.geolocation.address", STRING, PropertyMode.OPTIONAL);
|
||||
this.organizationRules.add("organization.type", "^(ASSOCIATION|INFORMAL|COOPERATIVE|MICROCOMPANY|COMPANY|INDIVIDUAL|OTHER)$", PropertyMode.MANDATORY);
|
||||
|
||||
this.organizationRules.add(SUBS, URL, PropertyMode.OPTIONAL);
|
||||
this.organizationRules.add(METRICS_NAME, STRING, PropertyMode.OPTIONAL);
|
||||
|
@ -183,8 +184,10 @@ public class PropertyChecker
|
|||
|
||||
this.serviceRules.add("host.name", STRING, PropertyMode.MANDATORY);
|
||||
this.serviceRules.add("host.description", STRING, PropertyMode.OPTIONAL);
|
||||
this.serviceRules.add("host.server.distribution", STRING, PropertyMode.MANDATORY);
|
||||
this.serviceRules.add("host.server.type", "^(NANO|PHYSICAL|VIRTUAL|SHARED|CLOUD)$", PropertyMode.MANDATORY);
|
||||
this.serviceRules.add("host.provider.type", "^(HOME|HOSTEDBAY|HOSTEDSERVER|OUTSOURCED)$", PropertyMode.MANDATORY);
|
||||
this.serviceRules.add("host.provider.hypervisor", STRING, PropertyMode.OPTIONAL);
|
||||
this.serviceRules.add("host.country.name", STRING, PropertyMode.WISHED);
|
||||
this.serviceRules.add("host.country.code", COUNTRY_CODE, PropertyMode.MANDATORY);
|
||||
|
||||
|
@ -290,12 +293,12 @@ public class PropertyChecker
|
|||
check = new PropertyCheck(lineIndex, "", Status.OK);
|
||||
check.setComment("OK");
|
||||
}
|
||||
else if ((StringUtils.isEmpty(line)) || (line.matches(COMMENT)))
|
||||
else if ((StringUtils.isEmpty(line)) || (isComment(line)))
|
||||
{
|
||||
check = new PropertyCheck(lineIndex, line, Status.OK);
|
||||
check.setComment("OK");
|
||||
}
|
||||
else if (!line.matches("^[^#].*[^\\s].*=.*$"))
|
||||
else if (!isProperty(line))
|
||||
{
|
||||
check = new PropertyCheck(lineIndex, line, Status.ERROR);
|
||||
check.setComment("Ligne malformée");
|
||||
|
@ -455,4 +458,83 @@ 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;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -76,8 +76,11 @@ public class PropertyRule
|
|||
}
|
||||
|
||||
/**
|
||||
* Check path.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean checkPath(final String value)
|
||||
{
|
||||
|
@ -108,11 +111,21 @@ 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;
|
||||
|
@ -214,6 +227,12 @@ public class PropertyRule
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mode.
|
||||
*
|
||||
* @param mode
|
||||
* the new mode
|
||||
*/
|
||||
public void setMode(final PropertyMode mode)
|
||||
{
|
||||
this.mode = mode;
|
||||
|
|
160
src/fr/devinsy/statoolinfos/cli/CLIUtils.java
Normal file
160
src/fr/devinsy/statoolinfos/cli/CLIUtils.java
Normal file
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2024 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.cli;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* The Class CLIUtils.
|
||||
*/
|
||||
public final class CLIUtils
|
||||
{
|
||||
/**
|
||||
* Instantiates a new statool infos CLI.
|
||||
*/
|
||||
private CLIUtils()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is matching.
|
||||
*
|
||||
* @param args
|
||||
* the args
|
||||
* @param regexps
|
||||
* the regexps
|
||||
* @return true, if is matching
|
||||
*/
|
||||
public static boolean isMatching(final String[] args, final String... regexps)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if ((args.length == 0) && (regexps == null))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if ((args.length != 0) && (regexps == null))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else if (args.length != regexps.length)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean ended = false;
|
||||
int index = 0;
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (index < args.length)
|
||||
{
|
||||
String arg = StringUtils.trim(args[index]);
|
||||
String regexp = regexps[index];
|
||||
|
||||
if (arg.matches(regexp))
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is matching ellipsis.
|
||||
*
|
||||
* @param args
|
||||
* the args
|
||||
* @param regexps
|
||||
* the regexps
|
||||
* @return true, if is matching ellipsis
|
||||
*/
|
||||
public static boolean isMatchingEllipsis(final String[] args, final String... regexps)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if ((args.length == 0) && (regexps == null))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if ((args.length != 0) && (regexps == null))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else if (args.length < regexps.length)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean ended = false;
|
||||
int index = 0;
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (index < args.length)
|
||||
{
|
||||
String arg = StringUtils.trim(args[index]);
|
||||
String regexp;
|
||||
if (index < regexps.length)
|
||||
{
|
||||
regexp = regexps[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
regexp = regexps[regexps.length - 1];
|
||||
}
|
||||
|
||||
if (arg.matches(regexp))
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 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,18 +110,22 @@ 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(" statoolinfos htmlize <configurationfile> generate web pages from conf");
|
||||
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 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");
|
||||
message.appendln(" statoolinfos uptime <configurationfile> update uptime journal");
|
||||
message.appendln();
|
||||
message.appendln(" statoolinfos list ip [-bot|-nobot] <fileordirectory> generate ip list from http log file");
|
||||
message.appendln(" statoolinfos list ua [-bot|-nobot] <fileordirectory> generate user agent list from http log file");
|
||||
message.appendln(" statoolinfos list visitors [-bot|-nobot] <fileordirectory> generate visitors (ip+ua) list from http log file");
|
||||
message.appendln(" statoolinfos stat ip [-bot|-nobot] <fileordirectory> generate stats about ip from http log file");
|
||||
message.appendln(" statoolinfos stat ua [-bot|-nobot] <fileordirectory> generate stats about user agent from http log file");
|
||||
message.appendln(" statoolinfos stat visitors [-bot|-nobot] <fileordirectory> generate stats about visitors (ip+ua) from http log file");
|
||||
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");
|
||||
|
||||
System.out.print(message.toString());
|
||||
}
|
||||
|
@ -138,65 +142,6 @@ public final class StatoolInfosCLI
|
|||
System.out.print(message.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is matching.
|
||||
*
|
||||
* @param args
|
||||
* the args
|
||||
* @param regexps
|
||||
* the regexps
|
||||
* @return true, if is matching
|
||||
*/
|
||||
public static boolean isMatching(final String[] args, final String... regexps)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if ((args.length == 0) && (regexps == null))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if ((args.length != 0) && (regexps == null))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else if (args.length != regexps.length)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean ended = false;
|
||||
int index = 0;
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (index < args.length)
|
||||
{
|
||||
String arg = args[index];
|
||||
String regexp = regexps[index];
|
||||
|
||||
if (arg.matches(regexp))
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize bash parameter.
|
||||
*
|
||||
|
@ -286,51 +231,51 @@ public final class StatoolInfosCLI
|
|||
|
||||
logger.debug("{} StatoolInfos call: {}", LocalDateTime.now(), new StringList(args).toStringSeparatedBy(" "));
|
||||
|
||||
if (isMatching(args))
|
||||
if (CLIUtils.isMatching(args))
|
||||
{
|
||||
logger.info("No parameter.");
|
||||
displayHelp();
|
||||
}
|
||||
else if (isMatching(args, "(-h|--h|--help)"))
|
||||
else if (CLIUtils.isMatching(args, "(-h|--h|--help)"))
|
||||
{
|
||||
displayHelp();
|
||||
}
|
||||
else if (isMatching(args, "(-v|-version|--version)"))
|
||||
else if (CLIUtils.isMatching(args, "(-v|-version|--version)"))
|
||||
{
|
||||
displayVersion();
|
||||
}
|
||||
else if (isMatching(args, "build", "\\s*.+\\.conf\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "build", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.build(configurationFile);
|
||||
StatoolInfosApp.build(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
|
||||
}
|
||||
}
|
||||
else if (isMatching(args, "clear", "\\s*.+\\.conf\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "clear", ".+\\.conf*"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.clear(configurationFile);
|
||||
StatoolInfosApp.clear(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error with [{}]: {}", configurationFile.getAbsoluteFile(), exception.getMessage());
|
||||
}
|
||||
}
|
||||
else if (isMatching(args, "crawl", "\\s*.+\\.conf\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "crawl", ".+\\.conf"))
|
||||
{
|
||||
Chrono chrono = new Chrono().start();
|
||||
|
||||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.crawl(configurationFile);
|
||||
StatoolInfosApp.crawl(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -339,14 +284,14 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
System.out.println(chrono.format());
|
||||
}
|
||||
else if (isMatching(args, "format", "\\s*.+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "format", ".+"))
|
||||
{
|
||||
Files inputs = FilesUtils.searchEndingWith(new File(args[1]), ".properties");
|
||||
for (File input : inputs)
|
||||
{
|
||||
try
|
||||
{
|
||||
StatoolInfos.format(input);
|
||||
StatoolInfosApp.format(input);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -355,61 +300,191 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (isMatching(args, "htmlize", "\\s*.+\\.conf\\s*"))
|
||||
{
|
||||
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 (isMatching(args, "list", "ip", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
|
||||
StatoolInfos.listIps(source, BotFilter.ALL);
|
||||
}
|
||||
else if (isMatching(args, "list", "ip", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listIps(source, filter);
|
||||
StatoolInfosApp.listIps(configurationFile, filter);
|
||||
}
|
||||
else if (isMatching(args, "list", "(useragent|ua)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", ".+\\.conf"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listUserAgents(source, BotFilter.ALL);
|
||||
StatoolInfosApp.listIps(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (isMatching(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
|
||||
StatoolInfos.listUserAgents(source, filter);
|
||||
}
|
||||
else if (isMatching(args, "list", "visitors", "\\s*\\S+\\s*"))
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
|
||||
StatoolInfos.listVisitors(source, BotFilter.ALL);
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
else if (isMatching(args, "list", "visitors", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
|
||||
StatoolInfosApp.listIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", ".+"))
|
||||
{
|
||||
Files files = new Files();
|
||||
for (int source = 2; source < args.length; source++)
|
||||
{
|
||||
files.add(new File(args[source]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.listIps(files, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(file|files)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfosApp.listAccessFiles(configurationFile);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(file|files)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listVisitors(source, filter);
|
||||
StatoolInfosApp.listLogs(configurationFile, filter);
|
||||
}
|
||||
else if (isMatching(args, "probe", "\\S*(-full|-today|-previousday|-\\d+)\\s*", "\\s*.+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "list", "(log|logs)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfosApp.listLogs(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.listLogs(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(log|logs)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.listUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(useragent|ua)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.listVisitors(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "(visitor|visitors)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.listVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "probe", "(-full|-today|-previousday|-\\d+)", ".+"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
|
@ -446,7 +521,7 @@ public final class StatoolInfosCLI
|
|||
try
|
||||
{
|
||||
System.out.println("Probing [" + input + "] with day count filter " + dayCountFilter);
|
||||
StatoolInfos.probe(input, dayCountFilter);
|
||||
StatoolInfosApp.probe(input, dayCountFilter);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -462,52 +537,116 @@ public final class StatoolInfosCLI
|
|||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (isMatching(args, "stat", "ip", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
|
||||
StatoolInfos.statIps(source, BotFilter.ALL);
|
||||
}
|
||||
else if (isMatching(args, "stat", "ip", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "stat", "ip", "(-all|-bot|-nobot)", ".+\\.conf*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.statIps(source, filter);
|
||||
StatoolInfosApp.statIps(configurationFile, filter);
|
||||
}
|
||||
else if (isMatching(args, "stat", "(useragent|ua)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "stat", "ip", ".+\\.conf"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
StatoolInfos.statUserAgents(source, BotFilter.ALL);
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfosApp.statIps(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (isMatching(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
|
||||
StatoolInfos.statUserAgents(source, filter);
|
||||
}
|
||||
else if (isMatching(args, "stat", "visitors", "\\s*\\S+\\s*"))
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
|
||||
StatoolInfos.statVisitors(source, BotFilter.ALL);
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
else if (isMatching(args, "stat", "visitors", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
|
||||
StatoolInfosApp.statIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "ip", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
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 source = new File(args[3]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.statVisitors(source, filter);
|
||||
StatoolInfosApp.statUserAgents(configurationFile, filter);
|
||||
}
|
||||
else if (isMatching(args, "tagdate", "\\s*.+\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", ".+\\.conf"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfosApp.statUserAgents(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.statUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(useragent|ua)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", "(-all|-bot|-nobot)", ".+"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.statVisitors(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "stat", "(visitor|visitors)", ".+"))
|
||||
{
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfosApp.statVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "tagdate", ".+"))
|
||||
{
|
||||
Files inputs = FilesUtils.searchEndingWith(new File(args[1]), ".properties");
|
||||
for (File input : inputs)
|
||||
{
|
||||
try
|
||||
{
|
||||
StatoolInfos.tagDate(input);
|
||||
StatoolInfosApp.tagDate(input);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -516,14 +655,14 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (isMatching(args, "uptime", "\\s*.+\\.conf\\s*"))
|
||||
else if (CLIUtils.isMatching(args, "uptime", ".+\\.conf"))
|
||||
{
|
||||
Chrono chrono = new Chrono().start();
|
||||
|
||||
File configurationFile = new File(StringUtils.trim(args[1]));
|
||||
try
|
||||
{
|
||||
StatoolInfos.uptime(configurationFile);
|
||||
StatoolInfosApp.uptime(configurationFile);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@ -532,23 +671,6 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
System.out.println(chrono.format());
|
||||
}
|
||||
else if (isMatching(args, "testHttpAccessLog", "\\s*\\S+\\s*"))
|
||||
{
|
||||
System.out.println("param1=" + args[1]);
|
||||
String source = normalizeBashParameter(args[1]);
|
||||
System.out.println("source=" + source);
|
||||
Files files = FilesUtils.searchByWildcard(source);
|
||||
System.out.println(files.size());
|
||||
try
|
||||
{
|
||||
StatoolInfos.testHttpAccessLog(files);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.error("Error: {}", exception.getMessage());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Bad usage.");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 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.http.HttpAccessLog;
|
||||
import fr.devinsy.statoolinfos.metrics.httpaccess.HttpAccessLog;
|
||||
|
||||
/**
|
||||
* The Enum LogFilter.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -22,6 +22,8 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +56,7 @@ public class Categories extends ArrayList<Category>
|
|||
|
||||
for (Category category : this)
|
||||
{
|
||||
if (category.getSoftwares().containsAnyIgnoreCase(softwareName))
|
||||
if (category.matchesSoftware(softwareName))
|
||||
{
|
||||
result.add(category);
|
||||
}
|
||||
|
@ -64,6 +66,43 @@ 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.
|
||||
*
|
||||
|
@ -84,7 +123,7 @@ public class Categories extends ArrayList<Category>
|
|||
{
|
||||
Category category = iterator.next();
|
||||
|
||||
if (category.getSoftwares().containsIgnoreCase(softwareName))
|
||||
if (category.matchesSoftware(softwareName))
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package fr.devinsy.statoolinfos.core;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
@ -27,22 +29,25 @@ import fr.devinsy.strings.StringList;
|
|||
*/
|
||||
public class Category
|
||||
{
|
||||
public static final String DEFAULT_LOGO_PATH = "categories/default.svg";
|
||||
public static final String DEFAULT_LOGO_PATH = "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 = name;
|
||||
this.description = description;
|
||||
this.softwares = new StringList();
|
||||
this.logoPath = DEFAULT_LOGO_PATH;
|
||||
this(name, description, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,11 +63,17 @@ 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;
|
||||
|
@ -90,11 +101,21 @@ 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;
|
||||
|
@ -109,7 +130,7 @@ public class Category
|
|||
{
|
||||
String result;
|
||||
|
||||
result = StatoolInfosUtils.toTechnicalName(getName());
|
||||
result = this.technicalName;
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -126,19 +147,58 @@ public class Category
|
|||
{
|
||||
boolean result;
|
||||
|
||||
if (this.softwares.containsIgnoreCase(service.getSoftwareName()))
|
||||
result = matchesSoftware(service.getSoftwareName());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches.
|
||||
*
|
||||
* @param softwareName
|
||||
* the software name
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean matchesSoftware(final String softwareName)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
String target = StringUtils.stripAccents(softwareName).replaceAll("[\\W\\s]", "");
|
||||
|
||||
boolean ended = false;
|
||||
Iterator<String> iterator = this.softwares.iterator();
|
||||
result = false;
|
||||
while (!ended)
|
||||
{
|
||||
if (iterator.hasNext())
|
||||
{
|
||||
String source = iterator.next();
|
||||
source = StringUtils.stripAccents(source).replaceAll("[\\W\\s]", "");
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(target, source))
|
||||
{
|
||||
ended = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ended = true;
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description.
|
||||
*
|
||||
* @param description
|
||||
* the new description
|
||||
*/
|
||||
public void setDescription(final String description)
|
||||
{
|
||||
this.description = description;
|
||||
|
@ -158,10 +218,16 @@ public class Category
|
|||
}
|
||||
else
|
||||
{
|
||||
this.logoPath = "categories/" + logoPath;
|
||||
this.logoPath = logoPath;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(final String name)
|
||||
{
|
||||
this.name = name;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -25,6 +25,7 @@ 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;
|
||||
|
||||
|
@ -54,6 +55,23 @@ 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.
|
||||
*
|
||||
|
@ -143,15 +161,16 @@ public class Configuration extends PathPropertyList
|
|||
*
|
||||
* @return the category file
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
*/
|
||||
public File getCategoryFile() throws StatoolInfosException
|
||||
{
|
||||
File result;
|
||||
|
||||
String path = get("conf.htmlize.categories");
|
||||
String path = get("conf.categories");
|
||||
if (StringUtils.isBlank(path))
|
||||
{
|
||||
throw new StatoolInfosException("Entry conf.htmlize.categories is missing in configuration file.");
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -299,54 +318,30 @@ public class Configuration extends PathPropertyList
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the htmlize directory.
|
||||
* Gets the probe http access log date pattern.
|
||||
*
|
||||
* @return the htmlize directory
|
||||
* @return the probe http access log date pattern
|
||||
*/
|
||||
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()
|
||||
public String getProbeHttpAccessLogDateTimePattern()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("conf.htmlize.directory");
|
||||
result = get("conf.probe.httpaccesslog.datetimepattern");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the htmlize input path.
|
||||
* Gets the probe http access log path filter.
|
||||
*
|
||||
* @return the htmlize input path
|
||||
* @throws MalformedURLException
|
||||
* @return the probe http access log path filter
|
||||
*/
|
||||
public URL getHtmlizeInputURL() throws MalformedURLException
|
||||
public String getProbeHttpAccessLogPathFilter()
|
||||
{
|
||||
URL result;
|
||||
String result;
|
||||
|
||||
result = new URL(get("conf.htmlize.input"));
|
||||
result = get("conf.probe.httpaccesslog.pathfilter");
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -382,6 +377,65 @@ public class Configuration extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the probe http access log sources.
|
||||
*
|
||||
* @return the probe http access log sources
|
||||
*/
|
||||
public StringList getProbeHttpAccessLogSources()
|
||||
{
|
||||
StringList result;
|
||||
|
||||
result = new StringList();
|
||||
String source = getProbeHttpAccessLogSource();
|
||||
|
||||
if (StringUtils.isNotBlank(source))
|
||||
{
|
||||
String[] paths = source.split(",");
|
||||
|
||||
for (String path : paths)
|
||||
{
|
||||
if (StringUtils.isNotBlank(path))
|
||||
{
|
||||
result.add(StringUtils.trim(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
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.
|
||||
*
|
||||
|
@ -474,6 +528,28 @@ 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.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2021-2023 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -39,16 +39,31 @@ public class DatabaseConfig
|
|||
this.password = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the password.
|
||||
*
|
||||
* @return the password
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the url.
|
||||
*
|
||||
* @return the url
|
||||
*/
|
||||
public String getUrl()
|
||||
{
|
||||
return this.url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user.
|
||||
*
|
||||
* @return the user
|
||||
*/
|
||||
public String getUser()
|
||||
{
|
||||
return this.user;
|
||||
|
@ -76,16 +91,34 @@ public class DatabaseConfig
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the password.
|
||||
*
|
||||
* @param password
|
||||
* the new password
|
||||
*/
|
||||
public void setPassword(final String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the url.
|
||||
*
|
||||
* @param url
|
||||
* the new url
|
||||
*/
|
||||
public void setUrl(final String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user.
|
||||
*
|
||||
* @param user
|
||||
* the new user
|
||||
*/
|
||||
public void setUser(final String user)
|
||||
{
|
||||
this.user = user;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -32,8 +32,9 @@ import fr.devinsy.statoolinfos.crawl.CrawlCache;
|
|||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperty;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
|
||||
import fr.devinsy.statoolinfos.util.Chrono;
|
||||
import fr.devinsy.statoolinfos.properties.PropertyClassType;
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.strings.StringSet;
|
||||
|
||||
|
@ -64,33 +65,9 @@ public class Factory
|
|||
{
|
||||
Categories result;
|
||||
|
||||
result = new Categories();
|
||||
|
||||
PathProperties properties = PathPropertyUtils.load(source);
|
||||
|
||||
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();
|
||||
result = loadCategories(properties);
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -128,6 +105,102 @@ 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.
|
||||
*
|
||||
|
@ -136,15 +209,20 @@ 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, IOException
|
||||
public static Configuration loadConfiguration(final File configurationFile) throws StatoolInfosException
|
||||
{
|
||||
Configuration result;
|
||||
|
||||
try
|
||||
{
|
||||
PathProperties properties = PathPropertyUtils.load(configurationFile);
|
||||
result = new Configuration(properties);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
throw new StatoolInfosException("Error reading configuration file: " + configurationFile, exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -168,7 +246,6 @@ public class Factory
|
|||
Federation result;
|
||||
|
||||
System.out.println("Loading federation " + inputURL);
|
||||
Chrono chrono = new Chrono().start();
|
||||
|
||||
if (inputURL == null)
|
||||
{
|
||||
|
@ -199,7 +276,7 @@ public class Factory
|
|||
result = new Federation(properties);
|
||||
result.setInputURL(inputURL);
|
||||
result.setInputFile(federationFile);
|
||||
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
PropertyChecker checker = new PropertyChecker();
|
||||
PropertyChecks checks = checker.checkFederation(result.getInputFile());
|
||||
|
@ -225,7 +302,6 @@ public class Factory
|
|||
result.getCrawlJournal().addAll(cache.restoreCrawlJournal());
|
||||
}
|
||||
}
|
||||
System.out.println("Federation loaded in " + chrono.format());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -251,7 +327,6 @@ 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);
|
||||
|
@ -308,7 +383,7 @@ public class Factory
|
|||
{
|
||||
result.setInputFile(inputFile);
|
||||
result.setInputURL(inputURL);
|
||||
result.setLogoFileName(result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
//
|
||||
PropertyChecker checker = new PropertyChecker();
|
||||
|
@ -354,8 +429,15 @@ 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
|
||||
{
|
||||
|
@ -372,12 +454,19 @@ public class Factory
|
|||
}
|
||||
else
|
||||
{
|
||||
PathProperties properties = PathPropertyUtils.load(inputFile);
|
||||
PathPropertyList properties = PathPropertyUtils.load(inputFile);
|
||||
if (properties.getClassType() != PropertyClassType.SERVICE)
|
||||
{
|
||||
logger.warn("WARNING: not file class service [{}]", inputURL);
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = new Service(properties);
|
||||
result.setOrganization(organization);
|
||||
result.setInputFile(inputFile);
|
||||
result.setInputURL(inputURL);
|
||||
result.setLogoFileName(organization.getTechnicalName() + "-" + result.getTechnicalName() + "-logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
result.setLogoFileName("logo" + StringUtils.defaultIfBlank(cache.getExtension(result.getLogoURL()), ".png"));
|
||||
|
||||
//
|
||||
PathProperties subs = result.getByPrefix("subs");
|
||||
|
@ -411,6 +500,7 @@ public class Factory
|
|||
result.addAll(metrics.getByPrefix("metrics."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -21,17 +21,19 @@ package fr.devinsy.statoolinfos.core;
|
|||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Year;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
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.MonthValues;
|
||||
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;
|
||||
|
||||
|
@ -215,6 +217,11 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crawl journal.
|
||||
*
|
||||
* @return the crawl journal
|
||||
*/
|
||||
public CrawlJournal getCrawlJournal()
|
||||
{
|
||||
return this.crawlJournal;
|
||||
|
@ -250,6 +257,11 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input checks.
|
||||
*
|
||||
* @return the input checks
|
||||
*/
|
||||
public PropertyChecks getInputChecks()
|
||||
{
|
||||
return this.inputChecks;
|
||||
|
@ -277,11 +289,21 @@ 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;
|
||||
|
@ -334,6 +356,11 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the logo file name.
|
||||
*
|
||||
* @return the logo file name
|
||||
*/
|
||||
public String getLogoFileName()
|
||||
{
|
||||
return this.logoFileName;
|
||||
|
@ -384,6 +411,23 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member organizations.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return the member organizations
|
||||
*/
|
||||
public Organizations getMemberOrganizations(final Year year)
|
||||
{
|
||||
Organizations result;
|
||||
|
||||
result = this.organizations.filterMemberFor(year);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metric month values all.
|
||||
*
|
||||
|
@ -480,6 +524,11 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the organizations.
|
||||
*
|
||||
* @return the organizations
|
||||
*/
|
||||
public Organizations getOrganizations()
|
||||
{
|
||||
return this.organizations;
|
||||
|
@ -504,6 +553,40 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service count by.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return the service count by
|
||||
*/
|
||||
public long getServiceCountBy(final Year year)
|
||||
{
|
||||
long result;
|
||||
|
||||
Organizations organizations = this.organizations.filterMemberFor(year);
|
||||
|
||||
result = 0;
|
||||
for (Organization organization : organizations)
|
||||
{
|
||||
for (Service service : organization.getServices().getBy(year))
|
||||
{
|
||||
Year memberStart = organization.getMemberStartYear();
|
||||
Year memberEnd = organization.getMemberEndYear();
|
||||
Year serviceStart = service.getStartYear();
|
||||
Year serviceEnd = service.getEndYear();
|
||||
|
||||
if (StatoolInfosUtils.overlapp(memberStart, memberEnd, serviceStart, serviceEnd))
|
||||
{
|
||||
result += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the all services.
|
||||
*
|
||||
|
@ -578,7 +661,22 @@ public class Federation extends PathPropertyList
|
|||
*
|
||||
* @return the start date
|
||||
*/
|
||||
public String getStartDate()
|
||||
public LocalDate getStartDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = StatoolInfosUtils.parseDate(getStartDateValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start date.
|
||||
*
|
||||
* @return the start date
|
||||
*/
|
||||
public String getStartDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -588,6 +686,29 @@ public class Federation extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start year.
|
||||
*
|
||||
* @return the start year
|
||||
*/
|
||||
public Year getStartYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getStartDate();
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the technical doc website.
|
||||
*
|
||||
|
@ -728,11 +849,23 @@ 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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -23,8 +23,6 @@ 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;
|
||||
|
@ -37,8 +35,6 @@ 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;
|
||||
|
@ -99,16 +95,31 @@ 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;
|
||||
|
@ -144,6 +155,11 @@ 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;
|
||||
|
@ -165,16 +181,34 @@ 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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -22,17 +22,18 @@ import java.io.File;
|
|||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Year;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.statoolinfos.checker.PropertyChecks;
|
||||
import fr.devinsy.statoolinfos.crawl.CrawlJournal;
|
||||
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.MonthValues;
|
||||
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;
|
||||
|
||||
|
@ -43,9 +44,6 @@ public class Organization extends PathPropertyList
|
|||
{
|
||||
private static final long serialVersionUID = -2709210934548224213L;
|
||||
|
||||
/**
|
||||
* The Enum Status.
|
||||
*/
|
||||
public enum Status
|
||||
{
|
||||
ACTIVE,
|
||||
|
@ -53,6 +51,17 @@ public class Organization extends PathPropertyList
|
|||
AWAY
|
||||
}
|
||||
|
||||
public enum Type
|
||||
{
|
||||
ASSOCIATION,
|
||||
COMPANY,
|
||||
COOPERATIVE,
|
||||
INDIVIDUAL,
|
||||
INFORMAL,
|
||||
MICROCOMPANY,
|
||||
OTHER
|
||||
}
|
||||
|
||||
private Federation federation;
|
||||
private Services services;
|
||||
private File inputFile;
|
||||
|
@ -140,10 +149,7 @@ public class Organization extends PathPropertyList
|
|||
{
|
||||
String result;
|
||||
|
||||
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate());
|
||||
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
|
||||
|
||||
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
|
||||
result = StatoolInfosUtils.toHumanDuration(getStartDate(), getEndDate());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -264,7 +270,22 @@ public class Organization extends PathPropertyList
|
|||
*
|
||||
* @return the end date
|
||||
*/
|
||||
public String getEndDate()
|
||||
public LocalDate getEndDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = StatoolInfosUtils.parseDate(getEndDateValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the end date.
|
||||
*
|
||||
* @return the end date
|
||||
*/
|
||||
public String getEndDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -274,6 +295,30 @@ public class Organization extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the end year.
|
||||
*
|
||||
* @return the end year
|
||||
*/
|
||||
public Year getEndYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getEndDate();
|
||||
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public Federation getFederation()
|
||||
{
|
||||
return this.federation;
|
||||
|
@ -456,10 +501,7 @@ public class Organization extends PathPropertyList
|
|||
{
|
||||
String result;
|
||||
|
||||
LocalDate startDate = StatoolInfosUtils.parseDate(getMemberStartDate());
|
||||
LocalDate endDate = StatoolInfosUtils.parseDate(getMemberEndDate());
|
||||
|
||||
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
|
||||
result = StatoolInfosUtils.toHumanDuration(getMemberStartDate(), getMemberEndDate());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -470,11 +512,66 @@ public class Organization extends PathPropertyList
|
|||
*
|
||||
* @return the member end date
|
||||
*/
|
||||
public String getMemberEndDate()
|
||||
public LocalDate getMemberEndDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = getDate("organization.memberof." + this.federation.getTechnicalName() + ".enddate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member end date.
|
||||
*
|
||||
* @param entityName
|
||||
* the entity name
|
||||
* @return the member end date
|
||||
*/
|
||||
public LocalDate getMemberEndDate(final String entityName)
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = getDate("organization.memberof." + entityName + ".enddate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member end date.
|
||||
*
|
||||
* @return the member end date
|
||||
*/
|
||||
public String getMemberEndDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("organization.memberof." + this.federation.getName() + ".enddate");
|
||||
result = get("organization.memberof." + this.federation.getTechnicalName() + ".enddate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member end year.
|
||||
*
|
||||
* @return the member end year
|
||||
*/
|
||||
public Year getMemberEndYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getMemberEndDate();
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -485,11 +582,66 @@ public class Organization extends PathPropertyList
|
|||
*
|
||||
* @return the member start date
|
||||
*/
|
||||
public String getMemberStartDate()
|
||||
public LocalDate getMemberStartDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = getDate("organization.memberof." + this.federation.getTechnicalName() + ".startdate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member start date.
|
||||
*
|
||||
* @param entityName
|
||||
* the entity name
|
||||
* @return the member start date
|
||||
*/
|
||||
public LocalDate getMemberStartDate(final String entityName)
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = getDate("organization.memberof." + entityName + ".startdate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member start date.
|
||||
*
|
||||
* @return the member start date
|
||||
*/
|
||||
public String getMemberStartDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("organization.memberof." + this.federation.getName() + ".startdate");
|
||||
result = get("organization.memberof." + this.federation.getTechnicalName() + ".startdate");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the member start year.
|
||||
*
|
||||
* @return the member start year
|
||||
*/
|
||||
public Year getMemberStartYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getMemberStartDate();
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -735,7 +887,22 @@ public class Organization extends PathPropertyList
|
|||
*
|
||||
* @return the start date
|
||||
*/
|
||||
public String getStartDate()
|
||||
public LocalDate getStartDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = StatoolInfosUtils.parseDate(getStartDateValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start date.
|
||||
*
|
||||
* @return the start date
|
||||
*/
|
||||
public String getStartDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -745,6 +912,30 @@ public class Organization extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start year.
|
||||
*
|
||||
* @return the start year
|
||||
*/
|
||||
public Year getStartYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getStartDate();
|
||||
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status.
|
||||
*
|
||||
|
@ -813,6 +1004,49 @@ public class Organization extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
public Type getType()
|
||||
{
|
||||
Type result;
|
||||
|
||||
String value = get("organization.type");
|
||||
|
||||
if (StringUtils.isBlank(value))
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "ASSOCIATION"))
|
||||
{
|
||||
result = Type.ASSOCIATION;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "COOPERATIVE"))
|
||||
{
|
||||
result = Type.COOPERATIVE;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "MICROCOMPANY"))
|
||||
{
|
||||
result = Type.MICROCOMPANY;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "COMPANY"))
|
||||
{
|
||||
result = Type.COMPANY;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "INDIVIDUAL"))
|
||||
{
|
||||
result = Type.INDIVIDUAL;
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(value, "OTHER"))
|
||||
{
|
||||
result = Type.OTHER;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL all.
|
||||
*
|
||||
|
@ -1061,7 +1295,7 @@ public class Organization extends PathPropertyList
|
|||
{
|
||||
boolean result;
|
||||
|
||||
if ((getServiceCount() == 0) && (getLogoURLValue() == null) && (getStartDate() == null))
|
||||
if ((getServiceCount() == 0) && (getLogoURLValue() == null) && (getStartDateValue() == null))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
@ -1097,6 +1331,51 @@ public class Organization extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is member.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return true, if is member
|
||||
*/
|
||||
public boolean isMember(final Year year)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (year == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Year startYear = getMemberStartYear();
|
||||
if (startYear == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Year endYear = getMemberEndYear();
|
||||
if (endYear == null)
|
||||
{
|
||||
endYear = Year.now();
|
||||
}
|
||||
|
||||
if ((year.isBefore(startYear)) || (year.isAfter(endYear)))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is valid.
|
||||
*
|
||||
|
@ -1120,21 +1399,45 @@ 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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -18,8 +18,12 @@
|
|||
*/
|
||||
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.
|
||||
|
@ -36,6 +40,22 @@ 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.
|
||||
*
|
||||
|
@ -182,6 +202,31 @@ public class Organizations extends ArrayList<Organization>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter member for.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return the organizations
|
||||
*/
|
||||
public Organizations filterMemberFor(final Year year)
|
||||
{
|
||||
Organizations result;
|
||||
|
||||
result = new Organizations();
|
||||
|
||||
for (Organization organization : this)
|
||||
{
|
||||
if (organization.isMember(year))
|
||||
{
|
||||
result.add(organization);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the active service count.
|
||||
*
|
||||
|
@ -201,6 +246,43 @@ 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.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -22,16 +22,15 @@ import java.io.File;
|
|||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Year;
|
||||
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.htmlize.charts.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.MonthValues;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.uptime.URLSet;
|
||||
|
@ -44,8 +43,6 @@ public class Service extends PathPropertyList
|
|||
{
|
||||
private static final long serialVersionUID = 3629841771102288863L;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(Service.class);
|
||||
|
||||
public enum HostProviderType
|
||||
{
|
||||
HOME,
|
||||
|
@ -136,10 +133,7 @@ public class Service extends PathPropertyList
|
|||
{
|
||||
String result;
|
||||
|
||||
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate());
|
||||
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
|
||||
|
||||
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
|
||||
result = StatoolInfosUtils.toHumanDuration(getStartDate(), getEndDate());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -225,6 +219,11 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the crawl journal.
|
||||
*
|
||||
* @return the crawl journal
|
||||
*/
|
||||
public CrawlJournal getCrawlJournal()
|
||||
{
|
||||
return this.crawlJournal;
|
||||
|
@ -250,7 +249,22 @@ public class Service extends PathPropertyList
|
|||
*
|
||||
* @return the end date
|
||||
*/
|
||||
public String getEndDate()
|
||||
public LocalDate getEndDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = StatoolInfosUtils.parseDate(getEndDateValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the end date value.
|
||||
*
|
||||
* @return the end date value
|
||||
*/
|
||||
public String getEndDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -260,6 +274,30 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the end year.
|
||||
*
|
||||
* @return the end year
|
||||
*/
|
||||
public Year getEndYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getEndDate();
|
||||
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host name.
|
||||
*
|
||||
|
@ -275,6 +313,21 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host provider hypervisor.
|
||||
*
|
||||
* @return the host provider hypervisor
|
||||
*/
|
||||
public String getHostProviderHypervisor()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("host.provider.hypervisor");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host provider type.
|
||||
*
|
||||
|
@ -299,6 +352,21 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host server distribution.
|
||||
*
|
||||
* @return the host server distribution
|
||||
*/
|
||||
public String getHostServerDistribution()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = get("host.server.distribution");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the host server type.
|
||||
*
|
||||
|
@ -323,6 +391,11 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input checks.
|
||||
*
|
||||
* @return the input checks
|
||||
*/
|
||||
public PropertyChecks getInputChecks()
|
||||
{
|
||||
return this.inputChecks;
|
||||
|
@ -350,11 +423,21 @@ 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;
|
||||
|
@ -442,6 +525,11 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the metrics.
|
||||
*
|
||||
* @return the metrics
|
||||
*/
|
||||
public MetricsList getMetrics()
|
||||
{
|
||||
return this.metricsList;
|
||||
|
@ -821,7 +909,22 @@ public class Service extends PathPropertyList
|
|||
*
|
||||
* @return the start date
|
||||
*/
|
||||
public String getStartDate()
|
||||
public LocalDate getStartDate()
|
||||
{
|
||||
LocalDate result;
|
||||
|
||||
result = StatoolInfosUtils.parseDate(getStartDateValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start date value.
|
||||
*
|
||||
* @return the start date value
|
||||
*/
|
||||
public String getStartDateValue()
|
||||
{
|
||||
String result;
|
||||
|
||||
|
@ -831,6 +934,30 @@ public class Service extends PathPropertyList
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the start year.
|
||||
*
|
||||
* @return the start year
|
||||
*/
|
||||
public Year getStartYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
LocalDate date = getStartDate();
|
||||
|
||||
if (date == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Year.from(date);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status.
|
||||
*
|
||||
|
@ -1026,7 +1153,7 @@ public class Service extends PathPropertyList
|
|||
{
|
||||
boolean result;
|
||||
|
||||
if (getEndDate() == null)
|
||||
if (getEndDateValue() == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
@ -1160,21 +1287,45 @@ 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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -18,8 +18,11 @@
|
|||
*/
|
||||
package fr.devinsy.statoolinfos.core;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -40,6 +43,58 @@ 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.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return the long
|
||||
*/
|
||||
public long countBy(final Year year)
|
||||
{
|
||||
long result;
|
||||
|
||||
result = 0;
|
||||
Year now = Year.now();
|
||||
for (Service service : this)
|
||||
{
|
||||
Year start = service.getStartYear();
|
||||
Year end = service.getEndYear();
|
||||
|
||||
if (start != null)
|
||||
{
|
||||
if (end == null)
|
||||
{
|
||||
end = now;
|
||||
}
|
||||
|
||||
if ((!start.isAfter(year) && (!end.isBefore(year))))
|
||||
{
|
||||
result += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by.
|
||||
*
|
||||
|
@ -117,6 +172,132 @@ public class Services extends ArrayList<Service>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by.
|
||||
*
|
||||
* @param year
|
||||
* the year
|
||||
* @return the by
|
||||
*/
|
||||
public Services getBy(final Year year)
|
||||
{
|
||||
Services result;
|
||||
|
||||
result = new Services();
|
||||
|
||||
if (year != null)
|
||||
{
|
||||
for (Service service : this)
|
||||
{
|
||||
Year startYear = service.getStartYear();
|
||||
Year endYear = service.getEndYear();
|
||||
if (endYear == null)
|
||||
{
|
||||
endYear = Year.now();
|
||||
}
|
||||
|
||||
if ((startYear != null) && (!year.isBefore(startYear)) && (!year.isAfter(endYear)))
|
||||
{
|
||||
result.add(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.
|
||||
*
|
||||
* @return the older
|
||||
*/
|
||||
public Service getOldestService()
|
||||
{
|
||||
Service result;
|
||||
|
||||
result = null;
|
||||
LocalDate oldestDate = null;
|
||||
for (Service current : this)
|
||||
{
|
||||
LocalDate date = current.getStartDate();
|
||||
|
||||
if (date != null)
|
||||
{
|
||||
LocalDate currentDate = current.getStartDate();
|
||||
if ((result == null) || (currentDate.isBefore(oldestDate)))
|
||||
{
|
||||
result = current;
|
||||
oldestDate = currentDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the oldest year.
|
||||
*
|
||||
* @return the oldest year
|
||||
*/
|
||||
public Year getOldestStartYear()
|
||||
{
|
||||
Year result;
|
||||
|
||||
Service oldestService = getOldestService();
|
||||
|
||||
if (oldestService == null)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = oldestService.getStartYear();
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -72,16 +72,31 @@ 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;
|
||||
|
@ -102,20 +117,30 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
/*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -77,6 +77,8 @@ 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);
|
||||
|
|
|
@ -1,571 +0,0 @@
|
|||
/*
|
||||
* 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.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
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.crawl.Crawler;
|
||||
import fr.devinsy.statoolinfos.htmlize.Htmlizer;
|
||||
import fr.devinsy.statoolinfos.metrics.Prober;
|
||||
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLog;
|
||||
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogIterator;
|
||||
import fr.devinsy.statoolinfos.metrics.http.HttpAccessLogParser;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
|
||||
import fr.devinsy.statoolinfos.stats.ip.IpStat;
|
||||
import fr.devinsy.statoolinfos.stats.ip.IpStator;
|
||||
import fr.devinsy.statoolinfos.stats.useragent.UserAgentStat;
|
||||
import fr.devinsy.statoolinfos.stats.useragent.UserAgentStator;
|
||||
import fr.devinsy.statoolinfos.stats.visitor.VisitorStat;
|
||||
import fr.devinsy.statoolinfos.stats.visitor.VisitorStator;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeJournal;
|
||||
import fr.devinsy.statoolinfos.uptime.UptimeSurveyor;
|
||||
import fr.devinsy.statoolinfos.util.Chrono;
|
||||
import fr.devinsy.statoolinfos.util.Files;
|
||||
import fr.devinsy.statoolinfos.util.LineIterator;
|
||||
import fr.devinsy.strings.StringList;
|
||||
import fr.devinsy.strings.StringsUtils;
|
||||
|
||||
/**
|
||||
* The Class StatoolInfos.
|
||||
*/
|
||||
public class StatoolInfos
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger(StatoolInfos.class);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the input
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void build(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
Builder.build(configurationFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the input
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void clear(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
logger.info("Clear {}", configurationFile.getAbsolutePath());
|
||||
Configuration configuration = Factory.loadConfiguration(configurationFile);
|
||||
|
||||
Builder.clear(configuration);
|
||||
new Crawler(configuration.getCrawlCacheDirectory()).clear();
|
||||
Htmlizer.clear(configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Crawl.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the input
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void crawl(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
Configuration configuration = Factory.loadConfiguration(configurationFile);
|
||||
Crawler crawler = new Crawler(configuration.getCrawlCacheDirectory());
|
||||
crawler.crawl(configuration.getCrawlInputURL());
|
||||
crawler.storeJournal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format.
|
||||
*
|
||||
* @param inputFile
|
||||
* the input file
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void format(final File inputFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
logger.info("Format {}", inputFile);
|
||||
|
||||
if (inputFile == null)
|
||||
{
|
||||
throw new StatoolInfosException("Input is undefined.");
|
||||
}
|
||||
else if (!inputFile.exists())
|
||||
{
|
||||
throw new StatoolInfosException("Input does not exist.");
|
||||
}
|
||||
else if (!inputFile.isFile())
|
||||
{
|
||||
throw new StatoolInfosException("Input is not a file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load input properties.
|
||||
PathProperties inputs = PathPropertyUtils.load(inputFile);
|
||||
|
||||
// Save input properties.
|
||||
inputFile.renameTo(new File(inputFile.getParentFile(), inputFile.getName() + ".bak"));
|
||||
PathPropertyUtils.save(inputFile, inputs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ips.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void listIps(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
IpStator stator = new IpStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
|
||||
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 (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 user agents.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void listUserAgents(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserAgentStator stator = new UserAgentStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
|
||||
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 (IllegalArgumentException exception)
|
||||
{
|
||||
System.out.println("Bad format line detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (DateTimeParseException exception)
|
||||
{
|
||||
System.out.println("Bad datetime format detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("File error detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List visitors.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void listVisitors(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
VisitorStator stator = new VisitorStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
|
||||
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 (IllegalArgumentException exception)
|
||||
{
|
||||
System.out.println("Bad format line detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (DateTimeParseException exception)
|
||||
{
|
||||
System.out.println("Bad datetime format detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("File error detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the configuration file
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void probe(final File configurationFile, final int dayCountFilter) throws StatoolInfosException, IOException
|
||||
{
|
||||
Prober.probe(configurationFile, dayCountFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat ips.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statIps(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
IpStator stator = new IpStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
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 (IllegalArgumentException exception)
|
||||
{
|
||||
System.out.println("Bad format line detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (DateTimeParseException exception)
|
||||
{
|
||||
System.out.println("Bad datetime format detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("File error detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat user agents.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statUserAgents(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
UserAgentStator stator = new UserAgentStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
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 (IllegalArgumentException exception)
|
||||
{
|
||||
System.out.println("Bad format line detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (DateTimeParseException exception)
|
||||
{
|
||||
System.out.println("Bad datetime format detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("File error detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat visitors.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statVisitors(final File source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
VisitorStator stator = new VisitorStator();
|
||||
|
||||
Chrono chrono = new Chrono().start();
|
||||
LineIterator iterator = new LineIterator(source);
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String line = iterator.next();
|
||||
HttpAccessLog log = HttpAccessLogParser.parseLog(line, HttpAccessLogParser.COMBINED_PATTERN);
|
||||
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 (IllegalArgumentException exception)
|
||||
{
|
||||
System.out.println("Bad format line detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (DateTimeParseException exception)
|
||||
{
|
||||
System.out.println("Bad datetime format detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
System.out.println("File error detected. Aborting…");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag date.
|
||||
*
|
||||
* @param inputFile
|
||||
* the source
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void tagDate(final File inputFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
System.out.println("TagDate " + inputFile);
|
||||
|
||||
if (inputFile == null)
|
||||
{
|
||||
throw new StatoolInfosException("Null parameter [source].");
|
||||
}
|
||||
else if (!inputFile.exists())
|
||||
{
|
||||
throw new StatoolInfosException("Input does not exist.");
|
||||
}
|
||||
else if (!inputFile.isFile())
|
||||
{
|
||||
throw new StatoolInfosException("Input is not a file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
StringList lines = StringsUtils.load(inputFile);
|
||||
|
||||
for (int lineIndex = 0; lineIndex < lines.size(); lineIndex++)
|
||||
{
|
||||
String line = lines.get(lineIndex);
|
||||
|
||||
if (StringUtils.startsWith(line, "file.datetime="))
|
||||
{
|
||||
lines.set(lineIndex, "file.datetime=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")));
|
||||
}
|
||||
}
|
||||
|
||||
inputFile.renameTo(new File(inputFile.getParentFile(), inputFile.getName() + ".bak"));
|
||||
StringsUtils.save(inputFile, lines);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test http access log.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void testHttpAccessLog(final Files source) throws IOException
|
||||
{
|
||||
HttpAccessLogIterator logs = new HttpAccessLogIterator(source);
|
||||
while (logs.hasNext())
|
||||
{
|
||||
System.out.println(logs.next().toStringLog());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uptime.
|
||||
*
|
||||
* @param configurationFile
|
||||
* the configuration file
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void uptime(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
HtmlizerContext.instance().configure(configurationFile);
|
||||
|
||||
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
|
||||
Federation federation = HtmlizerContext.instance().getFederation();
|
||||
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
|
||||
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -16,31 +16,25 @@
|
|||
* 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;
|
||||
package fr.devinsy.statoolinfos.core;
|
||||
|
||||
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 Manager.
|
||||
* The Class StatoolInfosContext.
|
||||
*/
|
||||
public class HtmlizerContext
|
||||
public class StatoolInfosContext
|
||||
{
|
||||
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 static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(StatoolInfosContext.class);
|
||||
|
||||
private LocalDateTime initDateTime;
|
||||
private Configuration configuration;
|
||||
private Federation federation;
|
||||
private Categories categories;
|
||||
|
@ -48,10 +42,18 @@ public class HtmlizerContext
|
|||
private UptimeJournal uptimeJournal;
|
||||
|
||||
/**
|
||||
* Instantiates a new manager.
|
||||
* 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.
|
||||
*/
|
||||
private HtmlizerContext()
|
||||
public StatoolInfosContext(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
configure(configurationFile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,46 +61,43 @@ public class HtmlizerContext
|
|||
*
|
||||
* @param configurationFile
|
||||
* the configuration file
|
||||
* @throws IOException
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public void configure(final File configurationFile) throws StatoolInfosException, IOException
|
||||
{
|
||||
this.configuration = Factory.loadConfiguration(configurationFile);
|
||||
|
||||
logger.info("Cache setting: {}", this.configuration.getCrawlCachePath());
|
||||
logger.info("Htmlize input setting: {}", this.configuration.getHtmlizeInputURL());
|
||||
logger.info("Htmlize directory setting: {}", this.configuration.getHtmlizeDirectoryPath());
|
||||
logger.info("Cache input setting: {}", this.configuration.getCrawlInputURL());
|
||||
|
||||
this.cache = new CrawlCache(this.configuration.getCrawlCacheDirectory());
|
||||
|
||||
File htmlizeDirectory = this.configuration.getHtmlizeDirectory();
|
||||
if (htmlizeDirectory == null)
|
||||
if (this.configuration.isFederation())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory undefined.");
|
||||
}
|
||||
else if (!htmlizeDirectory.exists())
|
||||
long startTime = System.currentTimeMillis();
|
||||
System.out.println("Loading configuration file.");
|
||||
this.federation = Factory.loadFederation(this.configuration.getCrawlInputURL(), this.cache);
|
||||
if (this.configuration.isCategoryFileDefined())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory is missing.");
|
||||
}
|
||||
else if (!htmlizeDirectory.isDirectory())
|
||||
{
|
||||
throw new IllegalArgumentException("Htmlize directory is not a directory.");
|
||||
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.configuration.isFederation())
|
||||
{
|
||||
this.federation = Factory.loadFederation(this.configuration.getHtmlizeInputURL(), this.cache);
|
||||
this.categories = Factory.loadCategories(this.configuration.getCategoryFile(), this.federation);
|
||||
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.");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalArgumentException("Not a federation configuration.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache.
|
||||
|
@ -161,32 +160,39 @@ public class HtmlizerContext
|
|||
}
|
||||
|
||||
/**
|
||||
* Htmlize directory.
|
||||
* Gets the uptime journal.
|
||||
*
|
||||
* @return the file
|
||||
* @return the uptime journal
|
||||
*/
|
||||
public File getHtmlizeDirectory()
|
||||
{
|
||||
File result;
|
||||
|
||||
result = this.configuration.getHtmlizeDirectory();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public UptimeJournal getUptimeJournal()
|
||||
{
|
||||
return this.uptimeJournal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
* Checks if is expired.
|
||||
*
|
||||
* @return the manager
|
||||
* @return true, if is expired
|
||||
*/
|
||||
public static HtmlizerContext instance()
|
||||
public boolean isExpired()
|
||||
{
|
||||
return SingletonHolder.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;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -27,6 +27,7 @@ import java.time.Instant;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Period;
|
||||
import java.time.Year;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
@ -49,8 +50,6 @@ 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;
|
||||
|
@ -60,8 +59,6 @@ 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);
|
||||
|
||||
|
@ -206,6 +203,63 @@ public class StatoolInfosUtils
|
|||
return new Date().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overlapp.
|
||||
*
|
||||
* @param start1
|
||||
* the start 1
|
||||
* @param end1
|
||||
* the end 1
|
||||
* @param start2
|
||||
* the start 2
|
||||
* @param end2
|
||||
* the end 2
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean overlapp(final Year start1, final Year end1, final Year start2, final Year end2)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if ((start1 == null) || (start2 == null))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Year end11;
|
||||
if (end1 == null)
|
||||
{
|
||||
end11 = Year.now();
|
||||
}
|
||||
else
|
||||
{
|
||||
end11 = end1;
|
||||
}
|
||||
|
||||
Year end22;
|
||||
if (end2 == null)
|
||||
{
|
||||
end22 = Year.now();
|
||||
}
|
||||
else
|
||||
{
|
||||
end22 = end2;
|
||||
}
|
||||
|
||||
if ((end22.isBefore(start1)) || (start2.isAfter(end11)))
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the date.
|
||||
*
|
||||
|
@ -235,6 +289,10 @@ public class StatoolInfosUtils
|
|||
{
|
||||
result = LocalDate.parse("01/" + date, DateTimeFormatter.ofPattern("dd/MM/yyyy"));
|
||||
}
|
||||
else if (date.matches("\\d{4}-\\d{2}"))
|
||||
{
|
||||
result = LocalDate.parse(date + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
|
@ -549,6 +607,13 @@ public class StatoolInfosUtils
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To integer.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the integer
|
||||
*/
|
||||
public static Integer toInteger(final String value)
|
||||
{
|
||||
Integer result;
|
||||
|
@ -759,6 +824,7 @@ 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
|
||||
{
|
||||
|
|
438
src/fr/devinsy/statoolinfos/core/categories.properties
Normal file
438
src/fr/devinsy/statoolinfos/core/categories.properties
Normal file
|
@ -0,0 +1,438 @@
|
|||
# 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
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -116,6 +116,11 @@ public class CrawlCache
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the directory.
|
||||
*
|
||||
* @return the directory
|
||||
*/
|
||||
public File getDirectory()
|
||||
{
|
||||
return this.directory;
|
||||
|
@ -147,8 +152,11 @@ public class CrawlCache
|
|||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* Restore crawl journal.
|
||||
*
|
||||
* @return the crawl journal
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public CrawlJournal restoreCrawlJournal() throws IOException
|
||||
{
|
||||
|
@ -231,7 +239,7 @@ public class CrawlCache
|
|||
}
|
||||
else
|
||||
{
|
||||
logger.info("CatGeneratoring from {}", url);
|
||||
logger.info("Restoring logo from {}", url);
|
||||
File logoFile = restoreFile(url);
|
||||
if (logoFile == null)
|
||||
{
|
||||
|
@ -261,9 +269,13 @@ public class CrawlCache
|
|||
}
|
||||
|
||||
/**
|
||||
* Restore to properties.
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
* the url
|
||||
* @return the path properties
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public PathProperties restoreToProperties(final URL url) throws IOException
|
||||
{
|
||||
|
@ -446,10 +458,11 @@ public class CrawlCache
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the journal URL.
|
||||
* Gets the crawl journal URL.
|
||||
*
|
||||
* @return the journal URL
|
||||
* @return the crawl journal URL
|
||||
* @throws MalformedURLException
|
||||
* the malformed URL exception
|
||||
*/
|
||||
public static URL getCrawlJournalURL() throws MalformedURLException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -34,6 +34,8 @@ public class CrawlLog
|
|||
*
|
||||
* @param url
|
||||
* the url
|
||||
* @param parentUrl
|
||||
* the parent url
|
||||
* @param status
|
||||
* the status
|
||||
*/
|
||||
|
@ -44,6 +46,11 @@ public class CrawlLog
|
|||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parent url.
|
||||
*
|
||||
* @return the parent url
|
||||
*/
|
||||
public URL getParentUrl()
|
||||
{
|
||||
return this.parentUrl;
|
||||
|
@ -71,11 +78,21 @@ 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;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -68,6 +68,8 @@ public class CrawlLogs extends ArrayList<CrawlLog>
|
|||
*
|
||||
* @param url
|
||||
* the url
|
||||
* @param parentUrl
|
||||
* the parent url
|
||||
* @param status
|
||||
* the status
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2021-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -18,6 +18,9 @@
|
|||
*/
|
||||
package fr.devinsy.statoolinfos.crawl;
|
||||
|
||||
/**
|
||||
* The Enum CrawlStatus.
|
||||
*/
|
||||
public enum CrawlStatus
|
||||
{
|
||||
BADCHILDCLASS,
|
||||
|
@ -31,6 +34,11 @@ public enum CrawlStatus
|
|||
UPDATED,
|
||||
URLNOTFOUND;
|
||||
|
||||
/**
|
||||
* Checks if is error.
|
||||
*
|
||||
* @return true, if is error
|
||||
*/
|
||||
public boolean isError()
|
||||
{
|
||||
boolean result;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
|
||||
* Copyright (C) 2020-2024 Christian Pierre MOMON <christian@momon.org>
|
||||
*
|
||||
* This file is part of StatoolInfos, simple service statistics tool.
|
||||
*
|
||||
|
@ -32,13 +32,13 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.statoolinfos.core.PropertyClassType;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||
import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperties;
|
||||
import fr.devinsy.statoolinfos.properties.PathProperty;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||
import fr.devinsy.statoolinfos.properties.PathPropertyUtils;
|
||||
import fr.devinsy.statoolinfos.properties.PropertyClassType;
|
||||
|
||||
/**
|
||||
* The Class Crawler.
|
||||
|
@ -151,8 +151,8 @@ public class Crawler
|
|||
}
|
||||
else
|
||||
{
|
||||
PathProperties downloadProperties = PathPropertyUtils.load(downloadFile);
|
||||
PropertyClassType downloadClass = PropertyClassType.of(downloadProperties.get("file.class"));
|
||||
PathPropertyList downloadProperties = PathPropertyUtils.load(downloadFile);
|
||||
PropertyClassType downloadClass = downloadProperties.getClassType();
|
||||
|
||||
if ((downloadClass == null) || (!downloadClass.isChildOf(parent)))
|
||||
{
|
||||
|
@ -250,6 +250,8 @@ public class Crawler
|
|||
*
|
||||
* @param url
|
||||
* the url
|
||||
* @param parentURL
|
||||
* the parent URL
|
||||
* @return the file
|
||||
*/
|
||||
public File crawlLogo(final URL url, final URL parentURL)
|
||||
|
@ -347,6 +349,7 @@ public class Crawler
|
|||
*
|
||||
* @return the crawl journal
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public CrawlJournal restoreJournal() throws IOException
|
||||
{
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
* 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.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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* 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.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
|
||||
* @throws IOException
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* 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
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* 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.IOException;
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Builds the.
|
||||
*
|
||||
* @param federation
|
||||
* the organization
|
||||
* @return the string
|
||||
* @throws StatoolInfosException
|
||||
* the statool infos exception
|
||||
* @throws IOException
|
||||
*/
|
||||
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.getStartDate(), "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.getServicesAll()))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue