mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2026-09-16 18:12:54 +00:00
ACS-9835-Improve code quality in alfresco-transform-core (#1116)
This commit is contained in:
+24
-24
@@ -38,29 +38,23 @@ jobs:
|
||||
pre_commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- id: changed-files
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/github-list-changes@v8.14.1
|
||||
with:
|
||||
write-list-to-env: true
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v8.26.0
|
||||
|
||||
veracode_sca:
|
||||
name: "Veracode - Source Clear Scan (SCA)"
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- pre_commit
|
||||
if: >
|
||||
github.ref_name == 'master' ||
|
||||
github.event_name == 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- name: "Clean-up SNAPSHOT artifacts"
|
||||
run: find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v8.26.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
|
||||
@@ -68,14 +62,16 @@ jobs:
|
||||
veracode_sast:
|
||||
name: "Pipeline SAST Scan"
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- pre_commit
|
||||
if: >
|
||||
(github.ref_name == 'master' || startsWith(github.ref_name, 'SP/') || startsWith(github.ref_name, 'HF/') || github.event_name == 'pull_request') &&
|
||||
github.actor != 'dependabot[bot]' &&
|
||||
!contains(github.event.head_commit.message, '[skip tests]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- name: "Login to Docker Hub"
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -87,7 +83,7 @@ jobs:
|
||||
registry: quay.io
|
||||
username: ${{ secrets.QUAY_USERNAME }}
|
||||
password: ${{ secrets.QUAY_PASSWORD }}
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v8.26.0
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
repository: "Alfresco/veracode-baseline-archive"
|
||||
@@ -141,8 +137,8 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[skip tests]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- uses: Alfresco/ya-pmd-scan@v4.1.0
|
||||
with:
|
||||
classpath-build-command: "mvn -ntp package -DskipTests"
|
||||
@@ -150,13 +146,15 @@ jobs:
|
||||
build_and_test:
|
||||
name: "Core & Base Snapshot deployment"
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- pre_commit
|
||||
if: >
|
||||
github.ref_name == 'master' &&
|
||||
github.event_name != 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- name: "Login to Docker Hub"
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -186,6 +184,8 @@ jobs:
|
||||
all_tests_matrix:
|
||||
name: ${{ matrix.testName }}
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- pre_commit
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -210,8 +210,8 @@ jobs:
|
||||
testProfile: aio-test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- name: "Login to Docker Hub"
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -251,8 +251,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.26.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.26.0
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
@@ -274,7 +274,7 @@ jobs:
|
||||
sudo service docker restart
|
||||
- name: "Clean-up SNAPSHOT artifacts"
|
||||
run: find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.14.1
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.26.0
|
||||
with:
|
||||
username: ${{ env.GIT_USERNAME }}
|
||||
email: ${{ env.GIT_EMAIL }}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Pre-Commit formatter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- precommit/**
|
||||
|
||||
jobs:
|
||||
format-code:
|
||||
name: "Reformat code"
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.head_commit.message, '[reformat code]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python ${{ inputs.python-version }}
|
||||
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
|
||||
with:
|
||||
python-version: "3.9"
|
||||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
||||
continue-on-error: true
|
||||
with:
|
||||
extra_args: --all-files
|
||||
- name: Update secrets baseline
|
||||
run: pip install detect-secrets && detect-secrets scan --baseline .secrets.baseline
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/git-commit-changes@v8.26.0
|
||||
with:
|
||||
username: ${{ secrets.BOT_GITHUB_USERNAME }}
|
||||
add-options: -u
|
||||
commit-message: "Apply Pre-Commit code formatting"
|
||||
skip-if-no-changes: true
|
||||
- name: Push changes
|
||||
run: git push
|
||||
@@ -8,7 +8,7 @@ repos:
|
||||
hooks:
|
||||
- id: check-format-and-headers
|
||||
name: Check format and headers and fix if necessary
|
||||
entry: ./scripts/check-format-and-headers.sh
|
||||
entry: ./scripts/hooks/check-format-and-headers.sh
|
||||
language: script
|
||||
files: ".*.java"
|
||||
pass_filenames: false
|
||||
|
||||
+4
-7
@@ -133,8 +133,7 @@
|
||||
"filename": "deprecated/alfresco-transformer-base/src/main/resources/application.yaml",
|
||||
"hashed_secret": "8c1ab56bc026c89468942df91166c35a277455a7",
|
||||
"is_verified": false,
|
||||
"line_number": 10,
|
||||
"is_secret": false
|
||||
"line_number": 10
|
||||
}
|
||||
],
|
||||
"engines/base/src/main/resources/application.yaml": [
|
||||
@@ -143,8 +142,7 @@
|
||||
"filename": "engines/base/src/main/resources/application.yaml",
|
||||
"hashed_secret": "8c1ab56bc026c89468942df91166c35a277455a7",
|
||||
"is_verified": false,
|
||||
"line_number": 10,
|
||||
"is_secret": false
|
||||
"line_number": 10
|
||||
}
|
||||
],
|
||||
"engines/libreoffice/src/test/resources/quick.vdx": [
|
||||
@@ -153,10 +151,9 @@
|
||||
"filename": "engines/libreoffice/src/test/resources/quick.vdx",
|
||||
"hashed_secret": "37c332070388a4797ccf1fa64f7029a193ce0371",
|
||||
"is_verified": false,
|
||||
"line_number": 2,
|
||||
"is_secret": false
|
||||
"line_number": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"generated_at": "2024-09-26T14:01:33Z"
|
||||
"generated_at": "2025-07-18T08:03:08Z"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
### Contributing
|
||||
Thanks for your interest in contributing to this project!
|
||||
|
||||
The following is a set of guidelines for contributing to this library. Most of them will make the life of the reviewer easier and therefore decrease the time required for the patch be included in the next version.
|
||||
|
||||
The project uses [pre-commit](https://pre-commit.com/) to format code (with [Spotless](https://github.com/diffplug/spotless)), validate license headers and check for secrets (with [detect-secrets](https://github.com/Yelp/detect-secrets)). To install the pre-commit hooks then first install pre-commit and then run:
|
||||
```shell
|
||||
pre-commit install
|
||||
```
|
||||
When you make a commit then these hooks will run and check the modified files. If it makes changes then you can review them and then `git commit` again to accept the changes.
|
||||
|
||||
#### Code Quality
|
||||
This project uses `spotless` that enforces `alfresco-formatter.xml` to ensure code quality.
|
||||
The code style definition file is taken always form the `master` branch of `alfresco-community-repo`.
|
||||
All downstream projects use this code style definition file as well.
|
||||
|
||||
To check code-style violations you can use:
|
||||
```bash
|
||||
mvn spotless:check
|
||||
```
|
||||
To reformat files you can use:
|
||||
```bash
|
||||
mvn spotless:apply
|
||||
```
|
||||
|
||||
#### Secret Detection
|
||||
|
||||
We are using [detect-secrets](https://github.com/Yelp/detect-secrets) to try to avoid accidentally publishing secret keys.
|
||||
If you have pre-commit installed then this should run automatically when making a commit. Usually there should be no issues,
|
||||
but if it finds a potential issue (e.g. a high entropy string) then you will see the following:
|
||||
|
||||
```shell
|
||||
Detect secrets...........................................................Failed
|
||||
- hook id: detect-secrets
|
||||
- exit code: 1
|
||||
|
||||
ERROR: Potential secrets about to be committed to git repo!
|
||||
|
||||
Secret Type: Secret Keyword
|
||||
Location: test.txt:1
|
||||
```
|
||||
|
||||
If this is a false positive and you actually want to commit the string then run these two commands:
|
||||
|
||||
```shell
|
||||
detect-secrets scan --baseline .secrets.baseline
|
||||
detect-secrets audit .secrets.baseline
|
||||
```
|
||||
|
||||
This will update the baseline file to include your new code and then allow you to review the detected secret and mark it as a false positive.
|
||||
Once you are finished then you can add `.secrets.baseline` to the staged changes and you should be able to create a commit.
|
||||
@@ -1,401 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="Spotless" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="999"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="999"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
+74
-66
@@ -26,17 +26,50 @@
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.alfresco.transformer.model.FileRefResponse;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
import static org.springframework.util.StringUtils.getFilenameExtension;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION_DEFAULT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setOrClearCoreVersion;
|
||||
import static org.alfresco.transformer.fs.FileManager.TempFileProvider.createTempFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.buildFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createAttachment;
|
||||
import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||
import static org.alfresco.transformer.fs.FileManager.deleteFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.getFilenameFromContentDisposition;
|
||||
import static org.alfresco.transformer.fs.FileManager.save;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.FILE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_EXTENSION;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_MIMETYPE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TARGET_EXTENSION;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TARGET_MIMETYPE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TEST_DELAY;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PROPERTY;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -56,56 +89,28 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setOrClearCoreVersion;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION_DEFAULT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transformer.fs.FileManager.TempFileProvider.createTempFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.buildFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createAttachment;
|
||||
import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||
import static org.alfresco.transformer.fs.FileManager.deleteFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.getFilenameFromContentDisposition;
|
||||
import static org.alfresco.transformer.fs.FileManager.save;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.FILE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_EXTENSION;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_MIMETYPE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TARGET_EXTENSION;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TARGET_MIMETYPE;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TEST_DELAY;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PROPERTY;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
import static org.springframework.util.StringUtils.getFilenameExtension;
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.alfresco.transformer.model.FileRefResponse;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* <p>Abstract Controller, provides structure and helper methods to sub-class transformer controllers. Sub classes
|
||||
* should implement {@link #transformImpl(String, String, String, Map, File, File)} and unimplemented methods from
|
||||
* {@link TransformController}.</p>
|
||||
* <p>
|
||||
* Abstract Controller, provides structure and helper methods to sub-class transformer controllers. Sub classes should implement {@link #transformImpl(String, String, String, Map, File, File)} and unimplemented methods from {@link TransformController}.
|
||||
* </p>
|
||||
*
|
||||
* <p>Status Codes:</p>
|
||||
* <p>
|
||||
* Status Codes:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>200 Success</li>
|
||||
* <li>400 Bad Request: Request parameter <name> is missing (missing mandatory parameter)</li>
|
||||
@@ -122,13 +127,13 @@ import static org.springframework.util.StringUtils.getFilenameExtension;
|
||||
* <li>500 Internal Server Error: Filename encoding error</li>
|
||||
* <li>507 Insufficient Storage: Failed to store the source file</li>
|
||||
*
|
||||
* <li>408 Request Timeout -- TODO implement general timeout mechanism rather than depend on transformer timeout
|
||||
* (might be possible for external processes)</li>
|
||||
* <li>408 Request Timeout -- TODO implement general timeout mechanism rather than depend on transformer timeout (might be possible for external processes)</li>
|
||||
* <li>415 Unsupported Media Type -- TODO possibly implement a check on supported source and target mimetypes (probably not)</li>
|
||||
* <li>429 Too Many Requests: Returned by liveness probe</li>
|
||||
* </ul>
|
||||
* <p>Provides methods to help super classes perform /transform requests. Also responses to /version, /ready and /live
|
||||
* requests.</p>
|
||||
* <p>
|
||||
* Provides methods to help super classes perform /transform requests. Also responses to /version, /ready and /live requests.
|
||||
* </p>
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractTransformerController implements TransformController
|
||||
@@ -260,11 +265,12 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
/**
|
||||
* '/transform' endpoint which consumes and produces 'application/json'
|
||||
*
|
||||
* This is the way to tell Spring to redirect the request to this endpoint
|
||||
* instead of the one which produces 'html'
|
||||
* This is the way to tell Spring to redirect the request to this endpoint instead of the one which produces 'html'
|
||||
*
|
||||
* @param request The transformation request
|
||||
* @param timeout Transformation timeout
|
||||
* @param request
|
||||
* The transformation request
|
||||
* @param timeout
|
||||
* Transformation timeout
|
||||
* @return A transformation reply
|
||||
*/
|
||||
@PostMapping(value = ENDPOINT_TRANSFORM, produces = APPLICATION_JSON_VALUE)
|
||||
@@ -461,8 +467,10 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
/**
|
||||
* Loads the file with the specified sourceReference from Alfresco Shared File Store
|
||||
*
|
||||
* @param sourceReference reference to the file in Alfresco Shared File Store
|
||||
* @param sourceExtension default extension if the file in Alfresco Shared File Store has none
|
||||
* @param sourceReference
|
||||
* reference to the file in Alfresco Shared File Store
|
||||
* @param sourceExtension
|
||||
* default extension if the file in Alfresco Shared File Store has none
|
||||
* @return the file containing the source content for the transformation
|
||||
*/
|
||||
private File loadSourceFile(final String sourceReference, final String sourceExtension)
|
||||
|
||||
+14
-21
@@ -30,16 +30,10 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.messaging.TransformMessageConverter;
|
||||
import org.alfresco.transformer.messaging.TransformReplySender;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -49,16 +43,18 @@ import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.messaging.TransformMessageConverter;
|
||||
import org.alfresco.transformer.messaging.TransformReplySender;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Queue Transformer service.
|
||||
* This service reads all the requests for the particular engine, forwards them to the worker
|
||||
* component (at this time the injected controller - to be refactored) and sends back the reply
|
||||
* to the {@link Message#getJMSReplyTo()} value. If this value is missing we've got to a dead end.
|
||||
* Queue Transformer service. This service reads all the requests for the particular engine, forwards them to the worker component (at this time the injected controller - to be refactored) and sends back the reply to the {@link Message#getJMSReplyTo()} value. If this value is missing we've got to a dead end.
|
||||
*
|
||||
* @author Lucian Tuca
|
||||
* created on 18/12/2018
|
||||
* @author Lucian Tuca created on 18/12/2018
|
||||
*/
|
||||
@Deprecated
|
||||
@Component
|
||||
@@ -139,10 +135,10 @@ public class QueueTransformService
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to convert the JMS {@link Message} to a {@link TransformRequest}
|
||||
* If any error occurs, a {@link TransformException} is thrown
|
||||
* Tries to convert the JMS {@link Message} to a {@link TransformRequest} If any error occurs, a {@link TransformException} is thrown
|
||||
*
|
||||
* @param msg Message to be deserialized
|
||||
* @param msg
|
||||
* Message to be deserialized
|
||||
* @return The converted {@link TransformRequest} instance
|
||||
*/
|
||||
private Optional<TransformRequest> convert(final Message msg, String correlationId)
|
||||
@@ -154,22 +150,19 @@ public class QueueTransformService
|
||||
}
|
||||
catch (MessageConversionException e)
|
||||
{
|
||||
String message =
|
||||
"MessageConversionException during T-Request deserialization of message with correlationID "
|
||||
String message = "MessageConversionException during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(BAD_REQUEST, message + e.getMessage());
|
||||
}
|
||||
catch (JMSException e)
|
||||
{
|
||||
String message =
|
||||
"JMSException during T-Request deserialization of message with correlationID "
|
||||
String message = "JMSException during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR, message + e.getMessage());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String message =
|
||||
"Exception during T-Request deserialization of message with correlationID "
|
||||
String message = "Exception during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR, message + e.getMessage());
|
||||
}
|
||||
|
||||
+25
-24
@@ -27,21 +27,16 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.text.MessageFormat.format;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.TypeMismatchException;
|
||||
@@ -53,13 +48,17 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* TransformController interface.
|
||||
* <br/>
|
||||
* It contains much of the common boilerplate code that each of
|
||||
* its concrete implementations need as default methods.
|
||||
* TransformController interface. <br/>
|
||||
* It contains much of the common boilerplate code that each of its concrete implementations need as default methods.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface TransformController
|
||||
@@ -69,19 +68,24 @@ public interface TransformController
|
||||
/**
|
||||
* Should be overridden in subclasses to initiate the transformation.
|
||||
*
|
||||
* @param transformName the name of the transformer in the engine_config.json file
|
||||
* @param sourceMimetype mimetype of the source
|
||||
* @param targetMimetype mimetype of the target
|
||||
* @param transformOptions transform options from the client
|
||||
* @param sourceFile the source file
|
||||
* @param targetFile the target file
|
||||
* @param transformName
|
||||
* the name of the transformer in the engine_config.json file
|
||||
* @param sourceMimetype
|
||||
* mimetype of the source
|
||||
* @param targetMimetype
|
||||
* mimetype of the target
|
||||
* @param transformOptions
|
||||
* transform options from the client
|
||||
* @param sourceFile
|
||||
* the source file
|
||||
* @param targetFile
|
||||
* the target file
|
||||
*/
|
||||
void transformImpl(String transformName, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions, File sourceFile, File targetFile);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #transformImpl(String, String, String, Map, File, File)} and timeout should be part of
|
||||
* the transformOptions created from the TransformRequest.
|
||||
* @deprecated use {@link #transformImpl(String, String, String, Map, File, File)} and timeout should be part of the transformOptions created from the TransformRequest.
|
||||
*/
|
||||
@Deprecated
|
||||
ResponseEntity<TransformReply> transform(TransformRequest transformRequest, Long timeout);
|
||||
@@ -93,8 +97,7 @@ public interface TransformController
|
||||
default void processTransform(final File sourceFile, final File targetFile,
|
||||
final String sourceMimetype, final String targetMimetype,
|
||||
final Map<String, String> transformOptions, final Long timeout)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* @return a friendly name for the T-Engine.
|
||||
@@ -131,8 +134,7 @@ public interface TransformController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of a template to display when there is an error when using the test UI for the T-Engine.
|
||||
* Defaults to {@code "error"}.
|
||||
* @return the name of a template to display when there is an error when using the test UI for the T-Engine. Defaults to {@code "error"}.
|
||||
* @See #transformForm
|
||||
*/
|
||||
@GetMapping("/error")
|
||||
@@ -142,8 +144,7 @@ public interface TransformController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of a template to display log messages when using the test UI for the T-Engine.
|
||||
* Defaults to {@code "log"}.
|
||||
* @return the name of a template to display log messages when using the test UI for the T-Engine. Defaults to {@code "log"}.
|
||||
* @See #transformForm
|
||||
*/
|
||||
@GetMapping("/log")
|
||||
|
||||
+3
-3
@@ -33,14 +33,14 @@ import static org.alfresco.transformer.fs.FileManager.deleteFile;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* TransformInterceptor
|
||||
* <br/>
|
||||
* TransformInterceptor <br/>
|
||||
* Handles ThreadLocal Log entries for each request.
|
||||
*/
|
||||
@Deprecated
|
||||
|
||||
+10
-9
@@ -26,29 +26,30 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
|
||||
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.registry.CombinedTransformConfig;
|
||||
import org.alfresco.transform.registry.TransformCache;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.registry.CombinedTransformConfig;
|
||||
import org.alfresco.transform.registry.TransformCache;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
|
||||
+7
-4
@@ -31,8 +31,6 @@ import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.model.FileRefResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
@@ -45,6 +43,9 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.model.FileRefResponse;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
@@ -62,7 +63,8 @@ public class AlfrescoSharedFileStoreClient
|
||||
/**
|
||||
* Retrieves a file from Shared File Store using given file reference
|
||||
*
|
||||
* @param fileRef File reference
|
||||
* @param fileRef
|
||||
* File reference
|
||||
* @return ResponseEntity<Resource>
|
||||
*/
|
||||
public ResponseEntity<Resource> retrieveFile(String fileRef)
|
||||
@@ -81,7 +83,8 @@ public class AlfrescoSharedFileStoreClient
|
||||
/**
|
||||
* Stores given file in Shared File Store
|
||||
*
|
||||
* @param file File to be stored
|
||||
* @param file
|
||||
* File to be stored
|
||||
* @return A FileRefResponse containing detail about file's reference
|
||||
*/
|
||||
public FileRefResponse saveFile(File file)
|
||||
|
||||
+22
-18
@@ -26,6 +26,15 @@
|
||||
*/
|
||||
package org.alfresco.transformer.config;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
@@ -46,18 +55,10 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
@Deprecated
|
||||
@Configuration
|
||||
public class MTLSConfig {
|
||||
public class MTLSConfig
|
||||
{
|
||||
|
||||
@Value("${client.ssl.key-store:#{null}}")
|
||||
private Resource keyStoreResource;
|
||||
@@ -86,13 +87,16 @@ public class MTLSConfig {
|
||||
if (isTlsOrMtlsConfigured())
|
||||
{
|
||||
return createRestTemplateWithSslContext(apacheSSLContextBuilder);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return new RestTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SSLContextBuilder apacheSSLContextBuilder() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
|
||||
public SSLContextBuilder apacheSSLContextBuilder() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
|
||||
{
|
||||
SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
|
||||
if (isKeystoreConfigured())
|
||||
{
|
||||
@@ -124,18 +128,18 @@ public class MTLSConfig {
|
||||
return keyStoreResource != null;
|
||||
}
|
||||
|
||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||
SSLConnectionSocketFactoryBuilder.create()
|
||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException
|
||||
{
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = SSLConnectionSocketFactoryBuilder.create()
|
||||
.setSslContext(sslContextBuilder.build())
|
||||
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||
if (hostNameVerificationDisabled) {
|
||||
if (hostNameVerificationDisabled)
|
||||
{
|
||||
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||
}
|
||||
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
.register("https", sslConnectionSocketFactory)
|
||||
.build();
|
||||
|
||||
|
||||
+8
-7
@@ -26,18 +26,19 @@
|
||||
*/
|
||||
package org.alfresco.transformer.config;
|
||||
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transformer.TransformInterceptor;
|
||||
import org.alfresco.transformer.TransformRegistryImpl;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.TransformInterceptor;
|
||||
import org.alfresco.transformer.TransformRegistryImpl;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
|
||||
+2
-1
@@ -26,10 +26,11 @@
|
||||
*/
|
||||
package org.alfresco.transformer.executors;
|
||||
|
||||
import static org.alfresco.transformer.executors.RuntimeExec.ExecutionResult;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import static org.alfresco.transformer.executors.RuntimeExec.ExecutionResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
+2
-2
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
package org.alfresco.transformer.executors;
|
||||
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
|
||||
+20
-27
@@ -39,24 +39,17 @@ import java.util.StringTokenizer;
|
||||
*
|
||||
* DUPLICATED FROM *alfresco-core*.
|
||||
*
|
||||
* This class is used to tokenize strings used as parameters for {@link RuntimeExec} objects.
|
||||
* Examples of such strings are as follows (ImageMagick-like parameters):
|
||||
* This class is used to tokenize strings used as parameters for {@link RuntimeExec} objects. Examples of such strings are as follows (ImageMagick-like parameters):
|
||||
* <ul>
|
||||
* <li><tt>-font Helvetica -pointsize 50</tt></li>
|
||||
* <li><tt>-font Helvetica -pointsize 50 -draw "circle 100,100 150,150"</tt></li>
|
||||
* <li><tt>-font Helvetica -pointsize 50 -draw "gravity south fill black text 0,12 'CopyRight'"</tt></li>
|
||||
* </ul>
|
||||
* The first is the simple case which would be parsed into Strings as follows:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50"</tt>
|
||||
* The first is the simple case which would be parsed into Strings as follows: <tt>"-font", "Helvetica", "-pointsize", "50"</tt>
|
||||
* <p/>
|
||||
* The second is more complex in that it includes a quoted parameter, which would be parsed as a single String:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50", "circle 100,100 150,150"</tt>
|
||||
* Note however that the quotation characters will be stripped from the token.
|
||||
* The second is more complex in that it includes a quoted parameter, which would be parsed as a single String: <tt>"-font", "Helvetica", "-pointsize", "50", "circle 100,100 150,150"</tt> Note however that the quotation characters will be stripped from the token.
|
||||
* <p/>
|
||||
* The third shows an example with embedded quotation marks, which would parse to:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50", "gravity south fill black text 0,12 'CopyRight'"</tt>
|
||||
* In this case, the embedded quotation marks (which must be different from those surrounding the parameter)
|
||||
* are preserved in the extracted token.
|
||||
* The third shows an example with embedded quotation marks, which would parse to: <tt>"-font", "Helvetica", "-pointsize", "50", "gravity south fill black text 0,12 'CopyRight'"</tt> In this case, the embedded quotation marks (which must be different from those surrounding the parameter) are preserved in the extracted token.
|
||||
* <p/>
|
||||
* The class does not understand escaped quotes such as <tt>p1 p2 "a b c \"hello\" d" p4</tt>
|
||||
*
|
||||
@@ -82,15 +75,12 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the tokens in a parameter string.
|
||||
* Any tokens not contained within single or double quotes will be tokenized in the normal
|
||||
* way i.e. by using whitespace separators and the standard StringTokenizer algorithm.
|
||||
* Any tokens which are contained within single or double quotes will be returned as single
|
||||
* String instances and will have their quote marks removed.
|
||||
* This method returns the tokens in a parameter string. Any tokens not contained within single or double quotes will be tokenized in the normal way i.e. by using whitespace separators and the standard StringTokenizer algorithm. Any tokens which are contained within single or double quotes will be returned as single String instances and will have their quote marks removed.
|
||||
* <p/>
|
||||
* See above for examples.
|
||||
*
|
||||
* @throws NullPointerException if the string to be tokenized was null.
|
||||
* @throws NullPointerException
|
||||
* if the string to be tokenized was null.
|
||||
*/
|
||||
public List<String> getAllTokens()
|
||||
{
|
||||
@@ -140,9 +130,7 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
|
||||
/**
|
||||
* The substrings will be a list of quoted and unquoted substrings.
|
||||
* The unquoted ones need to be further tokenized in the normal way.
|
||||
* The quoted ones must not be tokenized, but need their quotes stripped off.
|
||||
* The substrings will be a list of quoted and unquoted substrings. The unquoted ones need to be further tokenized in the normal way. The quoted ones must not be tokenized, but need their quotes stripped off.
|
||||
*/
|
||||
private List<Substring> getSubstrings(String str,
|
||||
List<Pair<Integer, Integer>> quotedRegionIndices)
|
||||
@@ -300,8 +288,10 @@ public class ExecParameterTokenizer
|
||||
/**
|
||||
* Make a new one.
|
||||
*
|
||||
* @param first The first member.
|
||||
* @param second The second member.
|
||||
* @param first
|
||||
* The first member.
|
||||
* @param second
|
||||
* The second member.
|
||||
*/
|
||||
public Pair(F first, S second)
|
||||
{
|
||||
@@ -339,16 +329,20 @@ public class ExecParameterTokenizer
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object o)
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Pair<?, ?> pair = (Pair<?, ?>) o;
|
||||
return Objects.equals(first, pair.first) &&
|
||||
Objects.equals(second, pair.second);
|
||||
}
|
||||
|
||||
@Override public int hashCode()
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(first, second);
|
||||
}
|
||||
@@ -360,4 +354,3 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+96
-126
@@ -54,51 +54,50 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* DUPLICATED FROM *alfresco-core*.
|
||||
*
|
||||
* This acts as a session similar to the <code>java.lang.Process</code>, but
|
||||
* logs the system standard and error streams.
|
||||
* This acts as a session similar to the <code>java.lang.Process</code>, but logs the system standard and error streams.
|
||||
* <p>
|
||||
* The bean can be configured to execute a command directly, or be given a map
|
||||
* of commands keyed by the <i>os.name</i> Java system property. In this map,
|
||||
* the default key that is used when no match is found is the
|
||||
* <b>{@link #KEY_OS_DEFAULT *}</b> key.
|
||||
* The bean can be configured to execute a command directly, or be given a map of commands keyed by the <i>os.name</i> Java system property. In this map, the default key that is used when no match is found is the <b>{@link #KEY_OS_DEFAULT *}</b> key.
|
||||
* <p>
|
||||
* Use the {@link #setProcessDirectory(String) processDirectory} property to change the default location
|
||||
* from which the command executes. The process's environment can be configured using the
|
||||
* {@link #setProcessProperties(Map) processProperties} property.
|
||||
* Use the {@link #setProcessDirectory(String) processDirectory} property to change the default location from which the command executes. The process's environment can be configured using the {@link #setProcessProperties(Map) processProperties} property.
|
||||
* <p>
|
||||
* Commands may use placeholders, e.g.
|
||||
* <pre><code>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* find
|
||||
* -name
|
||||
* ${filename}
|
||||
* </code></pre>
|
||||
* The <b>filename</b> property will be substituted for any supplied value prior to
|
||||
* each execution of the command. Currently, no checks are made to get or check the
|
||||
* properties contained within the command string. It is up to the client code to
|
||||
* dynamically extract the properties required if the required properties are not
|
||||
* known up front.
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* The <b>filename</b> property will be substituted for any supplied value prior to each execution of the command. Currently, no checks are made to get or check the properties contained within the command string. It is up to the client code to dynamically extract the properties required if the required properties are not known up front.
|
||||
* <p>
|
||||
* Sometimes, a variable may contain several arguments. . In this case, the arguments
|
||||
* need to be tokenized using a standard <tt>StringTokenizer</tt>. To force tokenization
|
||||
* of a value, use:
|
||||
* <pre><code>
|
||||
* Sometimes, a variable may contain several arguments. . In this case, the arguments need to be tokenized using a standard <tt>StringTokenizer</tt>. To force tokenization of a value, use:
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* SPLIT:${userArgs}
|
||||
* </code></pre>
|
||||
* You should not use this just to split up arguments that are known to require tokenization
|
||||
* up front. The <b>SPLIT:</b> directive works for the entire argument and will not do anything
|
||||
* if it is not at the beginning of the argument. Do not use <b>SPLIT:</b> to break up arguments
|
||||
* that are fixed, so avoid doing this:
|
||||
* <pre><code>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* You should not use this just to split up arguments that are known to require tokenization up front. The <b>SPLIT:</b> directive works for the entire argument and will not do anything if it is not at the beginning of the argument. Do not use <b>SPLIT:</b> to break up arguments that are fixed, so avoid doing this:
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* SPLIT:ls -lih
|
||||
* </code></pre>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* Instead, break the command up explicitly:
|
||||
* <pre><code>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* ls
|
||||
* -lih
|
||||
* </code></pre>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* Tokenization of quoted parameter values is handled by ExecParameterTokenizer, which
|
||||
* describes the support in more detail.
|
||||
* Tokenization of quoted parameter values is handled by ExecParameterTokenizer, which describes the support in more detail.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
@@ -164,7 +163,8 @@ public class RuntimeExec
|
||||
/**
|
||||
* Set the command to execute regardless of operating system
|
||||
*
|
||||
* @param command an array of strings representing the command (first entry) and arguments
|
||||
* @param command
|
||||
* an array of strings representing the command (first entry) and arguments
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setCommand(String[] command)
|
||||
@@ -173,11 +173,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the assumed charset of OUT and ERR streams generated by the executed command.
|
||||
* This defaults to the system default charset: {@link Charset#defaultCharset()}.
|
||||
* Sets the assumed charset of OUT and ERR streams generated by the executed command. This defaults to the system default charset: {@link Charset#defaultCharset()}.
|
||||
*
|
||||
* @param charsetCode a supported character set code
|
||||
* @throws UnsupportedCharsetException if the characterset code is not recognised by Java
|
||||
* @param charsetCode
|
||||
* a supported character set code
|
||||
* @throws UnsupportedCharsetException
|
||||
* if the characterset code is not recognised by Java
|
||||
*/
|
||||
public void setCharset(String charsetCode)
|
||||
{
|
||||
@@ -185,14 +186,10 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to wait for completion of the command or not. If there is no wait for completion,
|
||||
* then the return value of <i>out</i> and <i>err</i> buffers cannot be relied upon as the
|
||||
* command may still be in progress. Failure is therefore not possible unless the calling thread
|
||||
* waits for execution.
|
||||
* Set whether to wait for completion of the command or not. If there is no wait for completion, then the return value of <i>out</i> and <i>err</i> buffers cannot be relied upon as the command may still be in progress. Failure is therefore not possible unless the calling thread waits for execution.
|
||||
*
|
||||
* @param waitForCompletion <tt>true</tt> (default) is to wait for the command to exit,
|
||||
* or <tt>false</tt> to just return an exit code of 0 and whatever
|
||||
* output is available at that point.
|
||||
* @param waitForCompletion
|
||||
* <tt>true</tt> (default) is to wait for the command to exit, or <tt>false</tt> to just return an exit code of 0 and whatever output is available at that point.
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setWaitForCompletion(boolean waitForCompletion)
|
||||
@@ -201,26 +198,17 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system
|
||||
* property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used
|
||||
* to get a command where there is not direct match to the operating system key.
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used to get a command where there is not direct match to the operating system key.
|
||||
* <p>
|
||||
* Each command is an array of strings, the first of which represents the command and all subsequent
|
||||
* entries in the array represent the arguments. All elements of the array will be checked for
|
||||
* the presence of any substitution parameters (e.g. '{dir}'). The parameters can be set using the
|
||||
* {@link #setDefaultProperties(Map) defaults} or by passing the substitution values into the
|
||||
* {@link #execute(Map)} command.
|
||||
* Each command is an array of strings, the first of which represents the command and all subsequent entries in the array represent the arguments. All elements of the array will be checked for the presence of any substitution parameters (e.g. '{dir}'). The parameters can be set using the {@link #setDefaultProperties(Map) defaults} or by passing the substitution values into the {@link #execute(Map)} command.
|
||||
* <p>
|
||||
* If parameters passed may be multiple arguments, or if the values provided in the map are themselves
|
||||
* collections of arguments (not recommended), then prefix the value with <b>SPLIT:</b> to ensure that
|
||||
* the value is tokenized before being passed to the command. Any values that are not split, will be
|
||||
* passed to the command as single arguments. For example:<br>
|
||||
* If parameters passed may be multiple arguments, or if the values provided in the map are themselves collections of arguments (not recommended), then prefix the value with <b>SPLIT:</b> to ensure that the value is tokenized before being passed to the command. Any values that are not split, will be passed to the command as single arguments. For example:<br>
|
||||
* '<b>SPLIT: dir . ..</b>' becomes '<b>dir</b>', '<b>.</b>' and '<b>..</b>'.<br>
|
||||
* '<b>SPLIT: dir ${path}</b>' (if path is '<b>. ..</b>') becomes '<b>dir</b>', '<b>.</b>' and '<b>..</b>'.<br>
|
||||
* The splitting occurs post-subtitution. Where the arguments are known, it is advisable to avoid
|
||||
* <b>SPLIT:</b>.
|
||||
* The splitting occurs post-subtitution. Where the arguments are known, it is advisable to avoid <b>SPLIT:</b>.
|
||||
*
|
||||
* @param commandsByOS a map of command string arrays, keyed by operating system names
|
||||
* @param commandsByOS
|
||||
* a map of command string arrays, keyed by operating system names
|
||||
* @see #setDefaultProperties(Map)
|
||||
* @since 3.0
|
||||
*/
|
||||
@@ -264,11 +252,10 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system
|
||||
* property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used
|
||||
* to get a command where there is not direct match to the operating system key.
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used to get a command where there is not direct match to the operating system key.
|
||||
*
|
||||
* @param commandsByOS a map of command string keyed by operating system names
|
||||
* @param commandsByOS
|
||||
* a map of command string keyed by operating system names
|
||||
* @deprecated Use {@link #setCommandsAndArguments(Map)}
|
||||
*/
|
||||
public void setCommandMap(Map<String, String> commandsByOS)
|
||||
@@ -294,14 +281,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default command-line properties to use when executing the command.
|
||||
* These are properties that substitute variables defined in the command string itself.
|
||||
* Properties supplied during execution will overwrite the default properties.
|
||||
* Set the default command-line properties to use when executing the command. These are properties that substitute variables defined in the command string itself. Properties supplied during execution will overwrite the default properties.
|
||||
* <p>
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
*
|
||||
* @param defaultProperties property values
|
||||
* @param defaultProperties
|
||||
* property values
|
||||
*/
|
||||
public void setDefaultProperties(Map<String, String> defaultProperties)
|
||||
{
|
||||
@@ -309,14 +294,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set additional runtime properties (environment properties) that will used
|
||||
* by the executing process.
|
||||
* Set additional runtime properties (environment properties) that will used by the executing process.
|
||||
* <p>
|
||||
* Any keys or properties that start and end with <b>${...}</b> will be removed on the assumption
|
||||
* that these are unset properties. <tt>null</tt> values are translated to empty strings.
|
||||
* All keys and values are trimmed of leading and trailing whitespace.
|
||||
* Any keys or properties that start and end with <b>${...}</b> will be removed on the assumption that these are unset properties. <tt>null</tt> values are translated to empty strings. All keys and values are trimmed of leading and trailing whitespace.
|
||||
*
|
||||
* @param processProperties Runtime process properties
|
||||
* @param processProperties
|
||||
* Runtime process properties
|
||||
* @see Runtime#exec(String, String[], java.io.File)
|
||||
*/
|
||||
public void setProcessProperties(Map<String, String> processProperties)
|
||||
@@ -373,13 +356,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a property to existed processProperties.
|
||||
* Property should not be null or empty.
|
||||
* If property with the same value already exists then no change is made.
|
||||
* If property exists with a different value then old value is replaced with the new one.
|
||||
* Adds a property to existed processProperties. Property should not be null or empty. If property with the same value already exists then no change is made. If property exists with a different value then old value is replaced with the new one.
|
||||
*
|
||||
* @param name - property name
|
||||
* @param value - property value
|
||||
* @param name
|
||||
* - property name
|
||||
* @param value
|
||||
* - property value
|
||||
*/
|
||||
public void setProcessProperty(String name, String value)
|
||||
{
|
||||
@@ -429,10 +411,10 @@ public class RuntimeExec
|
||||
/**
|
||||
* Set the runtime location from which the command is executed.
|
||||
* <p>
|
||||
* If the value is an unsubsititued variable (<b>${...}</b>) then it is ignored.
|
||||
* If the location is not visible at the time of setting, a warning is issued only.
|
||||
* If the value is an unsubsititued variable (<b>${...}</b>) then it is ignored. If the location is not visible at the time of setting, a warning is issued only.
|
||||
*
|
||||
* @param processDirectory the runtime location from which to execute the command
|
||||
* @param processDirectory
|
||||
* the runtime location from which to execute the command
|
||||
*/
|
||||
public void setProcessDirectory(String processDirectory)
|
||||
{
|
||||
@@ -447,16 +429,17 @@ public class RuntimeExec
|
||||
{
|
||||
logger.warn(
|
||||
"The runtime process directory is not visible when setting property " +
|
||||
"'processDirectory': \n{}", this);
|
||||
"'processDirectory': \n{}",
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A comma or space separated list of values that, if returned by the executed command,
|
||||
* indicate an error value. This defaults to <b>"1, 2"</b>.
|
||||
* A comma or space separated list of values that, if returned by the executed command, indicate an error value. This defaults to <b>"1, 2"</b>.
|
||||
*
|
||||
* @param errCodesStr the error codes for the execution
|
||||
* @param errCodesStr
|
||||
* the error codes for the execution
|
||||
*/
|
||||
public void setErrorCodes(String errCodesStr)
|
||||
{
|
||||
@@ -492,9 +475,8 @@ public class RuntimeExec
|
||||
/**
|
||||
* Executes the statement that this instance was constructed with.
|
||||
*
|
||||
* @param properties the properties that the command might be executed with.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* @param properties
|
||||
* the properties that the command might be executed with. <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
* @return Returns the full execution results
|
||||
*/
|
||||
public ExecutionResult execute(Map<String, String> properties)
|
||||
@@ -503,15 +485,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the statement that this instance was constructed with an optional
|
||||
* timeout after which the command is asked to
|
||||
* Executes the statement that this instance was constructed with an optional timeout after which the command is asked to
|
||||
*
|
||||
* @param properties the properties that the command might be executed with.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* @param timeoutMs a timeout after which {@link Process#destroy()} is called.
|
||||
* ignored if less than or equal to zero. Note this method does not guarantee
|
||||
* to terminate the process (it is not a kill -9).
|
||||
* @param properties
|
||||
* the properties that the command might be executed with. <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
* @param timeoutMs
|
||||
* a timeout after which {@link Process#destroy()} is called. ignored if less than or equal to zero. Note this method does not guarantee to terminate the process (it is not a kill -9).
|
||||
* @return Returns the full execution results
|
||||
*/
|
||||
public ExecutionResult execute(Map<String, String> properties, final long timeoutMs)
|
||||
@@ -538,8 +517,7 @@ public class RuntimeExec
|
||||
if (timeoutMs > 0)
|
||||
{
|
||||
final String[] command = commandToExecute;
|
||||
timer.schedule(new TimerTask()
|
||||
{
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
@@ -655,8 +633,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the command that will be executed if no additional properties
|
||||
* were to be supplied
|
||||
* @return Returns the command that will be executed if no additional properties were to be supplied
|
||||
*/
|
||||
public String[] getCommand()
|
||||
{
|
||||
@@ -666,12 +643,11 @@ public class RuntimeExec
|
||||
/**
|
||||
* Get the command that will be executed post substitution.
|
||||
* <p>
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
*
|
||||
* @param properties the properties that the command might be executed with
|
||||
* @return Returns the command that will be executed should the additional properties
|
||||
* be supplied
|
||||
* @param properties
|
||||
* the properties that the command might be executed with
|
||||
* @return Returns the command that will be executed should the additional properties be supplied
|
||||
*/
|
||||
public String[] getCommand(Map<String, String> properties)
|
||||
{
|
||||
@@ -748,7 +724,8 @@ public class RuntimeExec
|
||||
private final String stdErr;
|
||||
|
||||
/**
|
||||
* @param process the process attached to Java - <tt>null</tt> is allowed
|
||||
* @param process
|
||||
* the process attached to Java - <tt>null</tt> is allowed
|
||||
*/
|
||||
private ExecutionResult(
|
||||
final Process process,
|
||||
@@ -785,9 +762,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the command in a form that make running from the command line simpler.
|
||||
* It is not a real attempt at making a command given all the operating system
|
||||
* and shell options, but makes copy, paste and edit a bit simpler.
|
||||
* Appends the command in a form that make running from the command line simpler. It is not a real attempt at making a command given all the operating system and shell options, but makes copy, paste and edit a bit simpler.
|
||||
*/
|
||||
private StringBuilder appendCommand(StringBuilder sb, String[] command)
|
||||
{
|
||||
@@ -823,10 +798,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper method to force a kill of the process that generated this result. This is
|
||||
* useful in cases where the process started is not expected to exit, or doesn't exit
|
||||
* quickly. If the {@linkplain RuntimeExec#setWaitForCompletion(boolean) "wait for completion"}
|
||||
* flag is <tt>false</tt> then the process may still be running when this result is returned.
|
||||
* A helper method to force a kill of the process that generated this result. This is useful in cases where the process started is not expected to exit, or doesn't exit quickly. If the {@linkplain RuntimeExec#setWaitForCompletion(boolean) "wait for completion"} flag is <tt>false</tt> then the process may still be running when this result is returned.
|
||||
*
|
||||
* @return <tt>true</tt> if the process was killed, otherwise <tt>false</tt>
|
||||
*/
|
||||
@@ -849,7 +821,8 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exitValue the command exit value
|
||||
* @param exitValue
|
||||
* the command exit value
|
||||
* @return Returns true if the code is a listed failure code
|
||||
* @see #setErrorCodes(String)
|
||||
*/
|
||||
@@ -859,8 +832,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns true if the command was deemed to be successful according to the
|
||||
* failure codes returned by the execution.
|
||||
* @return Returns true if the command was deemed to be successful according to the failure codes returned by the execution.
|
||||
*/
|
||||
public boolean getSuccess()
|
||||
{
|
||||
@@ -884,8 +856,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Gobbles an <code>InputStream</code> and writes it into a
|
||||
* <code>StringBuffer</code>
|
||||
* Gobbles an <code>InputStream</code> and writes it into a <code>StringBuffer</code>
|
||||
* <p>
|
||||
* The reading of the input stream is buffered.
|
||||
*/
|
||||
@@ -897,8 +868,8 @@ public class RuntimeExec
|
||||
private boolean completed;
|
||||
|
||||
/**
|
||||
* @param is an input stream to read - it will be wrapped in a buffer
|
||||
* for reading
|
||||
* @param is
|
||||
* an input stream to read - it will be wrapped in a buffer for reading
|
||||
*/
|
||||
public InputStreamReaderThread(InputStream is, Charset charset)
|
||||
{
|
||||
@@ -959,13 +930,13 @@ public class RuntimeExec
|
||||
this.wait(1000L); // 200 ms
|
||||
}
|
||||
catch (InterruptedException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg the message to add to the buffer
|
||||
* @param msg
|
||||
* the message to add to the buffer
|
||||
*/
|
||||
public void addToBuffer(String msg)
|
||||
{
|
||||
@@ -986,4 +957,3 @@ public class RuntimeExec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-16
@@ -27,16 +27,17 @@ package org.alfresco.transformer.executors;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_METADATA_EMBED;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_METADATA_EXTRACT;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PARAMETER;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
@@ -55,7 +56,8 @@ public interface Transformer
|
||||
String getTransformerId();
|
||||
|
||||
default void transform(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws TransformException {
|
||||
File sourceFile, File targetFile) throws TransformException
|
||||
{
|
||||
final String transformName = transformOptions.remove(TRANSFORM_NAME_PARAMETER);
|
||||
transformExtractOrEmbed(transformName, sourceMimetype, targetMimetype, transformOptions, sourceFile, targetFile);
|
||||
}
|
||||
@@ -111,23 +113,18 @@ public interface Transformer
|
||||
default void transform(String transformName, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
default void extractMetadata(String transformName, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* @deprecated The content repository has no non test embed metadata implementations.
|
||||
* This code exists in case there are custom implementations, that need to be converted to T-Engines.
|
||||
* It is simply a copy and paste from the content repository and has received limited testing.
|
||||
* @deprecated The content repository has no non test embed metadata implementations. This code exists in case there are custom implementations, that need to be converted to T-Engines. It is simply a copy and paste from the content repository and has received limited testing.
|
||||
*/
|
||||
default void embedMetadata(String transformName, String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> transformOptions,
|
||||
File sourceFile, File targetFile) throws Exception
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
|
||||
+22
-15
@@ -39,11 +39,8 @@ import java.net.MalformedURLException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Arrays;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -52,6 +49,9 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*/
|
||||
@@ -66,10 +66,11 @@ public class FileManager
|
||||
* Returns a File to be used to store the result of a transformation.
|
||||
*
|
||||
* @param request
|
||||
* @param filename The targetFilename supplied in the request. Only the filename if a path is used as part of the
|
||||
* temporary filename.
|
||||
* @param filename
|
||||
* The targetFilename supplied in the request. Only the filename if a path is used as part of the temporary filename.
|
||||
* @return a temporary File.
|
||||
* @throws TransformException if there was no target filename.
|
||||
* @throws TransformException
|
||||
* if there was no target filename.
|
||||
*/
|
||||
public static File createTargetFile(HttpServletRequest request, String filename)
|
||||
{
|
||||
@@ -96,9 +97,11 @@ public class FileManager
|
||||
/**
|
||||
* Checks the filename is okay to uses in a temporary file name.
|
||||
*
|
||||
* @param filename or path to be checked.
|
||||
* @param filename
|
||||
* or path to be checked.
|
||||
* @return the filename part of the supplied filename if it was a path.
|
||||
* @throws TransformException if there was no target filename.
|
||||
* @throws TransformException
|
||||
* if there was no target filename.
|
||||
*/
|
||||
private static String checkFilename(boolean source, String filename)
|
||||
{
|
||||
@@ -178,8 +181,10 @@ public class FileManager
|
||||
/**
|
||||
* Returns the file name for the target file
|
||||
*
|
||||
* @param fileName Desired file name
|
||||
* @param targetExtension File extension
|
||||
* @param fileName
|
||||
* Desired file name
|
||||
* @param targetExtension
|
||||
* File extension
|
||||
* @return Target file name
|
||||
*/
|
||||
public static String createTargetFileName(final String fileName, final String targetExtension)
|
||||
@@ -206,9 +211,11 @@ public class FileManager
|
||||
* Returns a File that holds the source content for a transformation.
|
||||
*
|
||||
* @param request
|
||||
* @param multipartFile from the request
|
||||
* @param multipartFile
|
||||
* from the request
|
||||
* @return a temporary File.
|
||||
* @throws TransformException if there was no source filename.
|
||||
* @throws TransformException
|
||||
* if there was no source filename.
|
||||
*/
|
||||
public static File createSourceFile(HttpServletRequest request, MultipartFile multipartFile)
|
||||
{
|
||||
@@ -231,8 +238,7 @@ public class FileManager
|
||||
}
|
||||
}
|
||||
|
||||
public static ResponseEntity<Resource> createAttachment(String targetFilename, File
|
||||
targetFile)
|
||||
public static ResponseEntity<Resource> createAttachment(String targetFilename, File targetFile)
|
||||
{
|
||||
Resource targetResource = load(targetFile);
|
||||
targetFilename = UriUtils.encodePath(getFilename(targetFilename), "UTF-8");
|
||||
@@ -256,7 +262,8 @@ public class FileManager
|
||||
{
|
||||
throw new RuntimeException(
|
||||
"Failed to created temp file: \n prefix: " + prefix +
|
||||
"\n suffix: " + suffix + "\n directory: " + directory, e);
|
||||
"\n suffix: " + suffix + "\n directory: " + directory,
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-9
@@ -27,6 +27,7 @@
|
||||
package org.alfresco.transformer.logging;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -42,10 +43,7 @@ import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Provides setter and getter methods to allow the current Thread to set various log properties and for these
|
||||
* values to be retrieved. The {@link #complete()} method should be called at the end of a request to flush the
|
||||
* current entry to an internal log Collection of the latest entries. The {@link #getLog()} method is used to obtain
|
||||
* access to this collection.
|
||||
* Provides setter and getter methods to allow the current Thread to set various log properties and for these values to be retrieved. The {@link #complete()} method should be called at the end of a request to flush the current entry to an internal log Collection of the latest entries. The {@link #getLog()} method is used to obtain access to this collection.
|
||||
*/
|
||||
@Deprecated
|
||||
public final class LogEntry
|
||||
@@ -205,7 +203,8 @@ public final class LogEntry
|
||||
{
|
||||
logEntry.durationStreamOut = System.currentTimeMillis() - logEntry.start -
|
||||
logEntry.durationStreamIn - max(logEntry.durationTransform,
|
||||
0) - max(logEntry.durationDelay, 0);
|
||||
0)
|
||||
- max(logEntry.durationDelay, 0);
|
||||
}
|
||||
currentLogEntry.remove();
|
||||
|
||||
@@ -241,9 +240,11 @@ public final class LogEntry
|
||||
(time(durationStreamIn) + ' ' +
|
||||
time(durationTransform) + ' ' +
|
||||
(durationDelay > 0
|
||||
? time(durationDelay) + ' ' + (durationStreamOut < 0 ? "-" : time(
|
||||
? time(durationDelay) + ' ' + (durationStreamOut < 0 ? "-"
|
||||
: time(
|
||||
durationStreamOut))
|
||||
: time(durationStreamOut))).trim() +
|
||||
: time(durationStreamOut))).trim()
|
||||
+
|
||||
")";
|
||||
}
|
||||
|
||||
@@ -279,7 +280,8 @@ public final class LogEntry
|
||||
|
||||
private String time(long ms)
|
||||
{
|
||||
return ms == -1 ? "" : size(ms, "1ms",
|
||||
return ms == -1 ? ""
|
||||
: size(ms, "1ms",
|
||||
new String[]{"ms", "s", "min", "hr"},
|
||||
new long[]{1000, 60 * 1000, 60 * 60 * 1000, Long.MAX_VALUE});
|
||||
}
|
||||
@@ -287,7 +289,8 @@ public final class LogEntry
|
||||
private String size(long size)
|
||||
{
|
||||
// TODO fix numeric overflow in TB expression
|
||||
return size == -1 ? "" : size(size, "1 byte",
|
||||
return size == -1 ? ""
|
||||
: size(size, "1 byte",
|
||||
new String[]{"bytes", " KB", " MB", " GB", " TB"},
|
||||
new long[]{1024, 1024 * 1024, 1024 * 1024 * 1024, 1024 * 1024 * 1024 * 1024, Long.MAX_VALUE});
|
||||
}
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ package org.alfresco.transformer.logging;
|
||||
@Deprecated
|
||||
public interface StandardMessages
|
||||
{
|
||||
String LICENCE =
|
||||
"If the Alfresco software was purchased under a paid Alfresco license, the terms of the paid license agreement \n" +
|
||||
String LICENCE = "If the Alfresco software was purchased under a paid Alfresco license, the terms of the paid license agreement \n" +
|
||||
"will prevail. Otherwise, the software is provided under terms of the GNU LGPL v3 license. \n" +
|
||||
"See the license at http://www.gnu.org/licenses/lgpl-3.0.txt. or in /LICENSE.txt \n\n";
|
||||
}
|
||||
|
||||
+4
-7
@@ -29,7 +29,6 @@ package org.alfresco.transformer.messaging;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Queue;
|
||||
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -45,14 +44,14 @@ import org.springframework.lang.NonNull;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the
|
||||
* T-Engine able to read from queues and send a reply back.
|
||||
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the T-Engine able to read from queues and send a reply back.
|
||||
*
|
||||
* @author Lucian Tuca
|
||||
* created on 18/12/2018
|
||||
* @author Lucian Tuca created on 18/12/2018
|
||||
*/
|
||||
@Deprecated
|
||||
@Configuration
|
||||
@@ -107,5 +106,3 @@ public class MessagingConfig implements JmsListenerConfigurer
|
||||
return new ActiveMQQueue(engineRequestQueueValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-19
@@ -27,11 +27,13 @@
|
||||
|
||||
package org.alfresco.transformer.messaging;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
@@ -39,15 +41,13 @@ import org.springframework.jms.support.converter.MessageType;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* TODO: Duplicated from the Router
|
||||
* Custom wrapper over MappingJackson2MessageConverter for T-Request/T-Reply objects.
|
||||
* TODO: Duplicated from the Router Custom wrapper over MappingJackson2MessageConverter for T-Request/T-Reply objects.
|
||||
*
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
@@ -56,16 +56,13 @@ import jakarta.jms.Session;
|
||||
public class TransformMessageConverter implements MessageConverter
|
||||
{
|
||||
private static final MappingJackson2MessageConverter converter;
|
||||
private static final JavaType TRANSFORM_REQUEST_TYPE =
|
||||
TypeFactory.defaultInstance().constructType(TransformRequest.class);
|
||||
private static final JavaType TRANSFORM_REQUEST_TYPE = TypeFactory.defaultInstance().constructType(TransformRequest.class);
|
||||
|
||||
static
|
||||
{
|
||||
converter = new MappingJackson2MessageConverter()
|
||||
{
|
||||
converter = new MappingJackson2MessageConverter() {
|
||||
@Override
|
||||
@NonNull
|
||||
protected JavaType getJavaTypeForMessage(final Message message) throws JMSException
|
||||
@NonNull protected JavaType getJavaTypeForMessage(final Message message) throws JMSException
|
||||
{
|
||||
if (message.getStringProperty("_type") == null)
|
||||
{
|
||||
@@ -78,13 +75,11 @@ public class TransformMessageConverter implements MessageConverter
|
||||
converter.setTypeIdPropertyName("_type");
|
||||
converter.setTypeIdMappings(ImmutableMap.of(
|
||||
TransformRequest.class.getName(), TransformRequest.class,
|
||||
TransformReply.class.getName(), TransformReply.class)
|
||||
);
|
||||
TransformReply.class.getName(), TransformReply.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Message toMessage(
|
||||
@NonNull public Message toMessage(
|
||||
@NonNull final Object object,
|
||||
@NonNull final Session session) throws JMSException, MessageConversionException
|
||||
{
|
||||
@@ -92,8 +87,7 @@ public class TransformMessageConverter implements MessageConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Object fromMessage(@NonNull final Message message) throws JMSException
|
||||
@NonNull public Object fromMessage(@NonNull final Message message) throws JMSException
|
||||
{
|
||||
return converter.fromMessage(message);
|
||||
}
|
||||
|
||||
+3
-3
@@ -28,18 +28,18 @@ package org.alfresco.transformer.messaging;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* TODO: Duplicated from the Router
|
||||
* TransformReplySender Bean
|
||||
* TODO: Duplicated from the Router TransformReplySender Bean
|
||||
* <p/>
|
||||
* JMS message sender/publisher
|
||||
*
|
||||
|
||||
+39
-56
@@ -26,11 +26,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer.metadataExtractors;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -48,46 +43,39 @@ import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Helper methods for metadata extract and embed.
|
||||
* <p>
|
||||
* <i>Much of the code is based on AbstractMappingMetadataExtracter from the
|
||||
* content repository. The code has been simplified to only set up mapping one way.</i>
|
||||
* <i>Much of the code is based on AbstractMappingMetadataExtracter from the content repository. The code has been simplified to only set up mapping one way.</i>
|
||||
* <p>
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-extract"}
|
||||
* (specified in the {@code engine_config.json}), it is indicating that it can extract metadata from {@code <MIMETYPE>}.
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-extract"} (specified in the {@code engine_config.json}), it is indicating that it can extract metadata from {@code <MIMETYPE>}.
|
||||
*
|
||||
* The transform results in a Map of extracted properties encoded as json being returned to the content repository.
|
||||
* <ul>
|
||||
* <li>The content repository will use a transform in preference to any metadata extractors it might have defined
|
||||
* locally for the same MIMETYPE.</li>
|
||||
* <li>The T-Engine's Controller class will call a method in a class that extends {@link AbstractMetadataExtractor}
|
||||
* based on the source and target mediatypes in the normal way.</li>
|
||||
* <li>The method extracts ALL available metadata is extracted from the document and then calls
|
||||
* {@link #mapMetadataAndWrite(File, Map, Map)}.</li>
|
||||
* <li>Selected values from the available metadata are mapped into content repository property names and values,
|
||||
* depending on what is defined in a {@code "<classname>_metadata_extract.properties"} file.</li>
|
||||
* <li>The selected values are set back to the content repository as a JSON representation of a Map, where the values
|
||||
* are applied to the source node.</li>
|
||||
* <li>The content repository will use a transform in preference to any metadata extractors it might have defined locally for the same MIMETYPE.</li>
|
||||
* <li>The T-Engine's Controller class will call a method in a class that extends {@link AbstractMetadataExtractor} based on the source and target mediatypes in the normal way.</li>
|
||||
* <li>The method extracts ALL available metadata is extracted from the document and then calls {@link #mapMetadataAndWrite(File, Map, Map)}.</li>
|
||||
* <li>Selected values from the available metadata are mapped into content repository property names and values, depending on what is defined in a {@code "<classname>_metadata_extract.properties"} file.</li>
|
||||
* <li>The selected values are set back to the content repository as a JSON representation of a Map, where the values are applied to the source node.</li>
|
||||
* </ul>
|
||||
* To support the same functionality as metadata extractors configured inside the content repository,
|
||||
* extra key value pairs may be returned from {@link #extractMetadata}. These are:
|
||||
* To support the same functionality as metadata extractors configured inside the content repository, extra key value pairs may be returned from {@link #extractMetadata}. These are:
|
||||
* <ul>
|
||||
* <li>{@code "sys:overwritePolicy"} which can specify the
|
||||
* {@code org.alfresco.repo.content.metadata.MetadataExtracter.OverwritePolicy} name. Defaults to "PRAGMATIC".</li>
|
||||
* <li>{@code "sys:enableStringTagging"} if {@code "true"} finds or creates tags for each string mapped to
|
||||
* {@code cm:taggable}. Defaults to {@code "false"} to ignore mapping strings to tags.</li>
|
||||
* <li>{@code "sys:overwritePolicy"} which can specify the {@code org.alfresco.repo.content.metadata.MetadataExtracter.OverwritePolicy} name. Defaults to "PRAGMATIC".</li>
|
||||
* <li>{@code "sys:enableStringTagging"} if {@code "true"} finds or creates tags for each string mapped to {@code cm:taggable}. Defaults to {@code "false"} to ignore mapping strings to tags.</li>
|
||||
* <li>{@code "sys:carryAspectProperties"}</li>
|
||||
* <li>{@code "sys:stringTaggingSeparators"}</li>
|
||||
* </ul>
|
||||
*
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-embed"}, it is
|
||||
* indicating that it can embed metadata in {@code <MIMETYPE>}.
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-embed"}, it is indicating that it can embed metadata in {@code <MIMETYPE>}.
|
||||
*
|
||||
* The transform results in a new version of supplied source file that contains the metadata supplied in the transform
|
||||
* options.
|
||||
* The transform results in a new version of supplied source file that contains the metadata supplied in the transform options.
|
||||
*
|
||||
* @author Jesper Steen Møller
|
||||
* @author Derek Hulley
|
||||
@@ -208,9 +196,8 @@ public abstract class AbstractMetadataExtractor
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#getDefaultMapping.
|
||||
*
|
||||
* This method provides a <i>mapping</i> of where to store the values extracted from the documents. The list of
|
||||
* properties need <b>not</b> include all metadata values extracted from the document. This mapping should be
|
||||
* defined in a file based on the class name: {@code "<classname>_metadata_extract.properties"}
|
||||
* This method provides a <i>mapping</i> of where to store the values extracted from the documents. The list of properties need <b>not</b> include all metadata values extracted from the document. This mapping should be defined in a file based on the class name: {@code "<classname>_metadata_extract.properties"}
|
||||
*
|
||||
* @return Returns a static mapping. It may not be null.
|
||||
*/
|
||||
private Map<String, Set<String>> buildExtractMapping()
|
||||
@@ -260,13 +247,10 @@ public abstract class AbstractMetadataExtractor
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#getDefaultEmbedMapping.
|
||||
*
|
||||
* This method provides a <i>mapping</i> of model properties that should be embedded in the content. The list of
|
||||
* properties need <b>not</b> include all properties. This mapping should be defined in a file based on the class
|
||||
* name: {@code "<classname>_metadata_embed.properties"}
|
||||
* This method provides a <i>mapping</i> of model properties that should be embedded in the content. The list of properties need <b>not</b> include all properties. This mapping should be defined in a file based on the class name: {@code "<classname>_metadata_embed.properties"}
|
||||
* <p>
|
||||
* If no {@code "<classname>_metadata_embed.properties"} file is found, a reverse of the
|
||||
* {@code "<classname>_metadata_extract.properties"} will be assumed. A last win approach will be used for handling
|
||||
* duplicates.
|
||||
* If no {@code "<classname>_metadata_embed.properties"} file is found, a reverse of the {@code "<classname>_metadata_extract.properties"} will be assumed. A last win approach will be used for handling duplicates.
|
||||
*
|
||||
* @return Returns a static mapping. It may not be null.
|
||||
*/
|
||||
private Map<String, Set<String>> buildEmbedMapping()
|
||||
@@ -306,7 +290,8 @@ public abstract class AbstractMetadataExtractor
|
||||
modelProperty = getQNameString(namespacesByPrefix, entry, modelProperty, EMBED);
|
||||
String[] metadataKeysArray = metadataKeysString.split(",");
|
||||
Set<String> metadataKeys = new HashSet<String>(metadataKeysArray.length);
|
||||
for (String metadataKey : metadataKeysArray) {
|
||||
for (String metadataKey : metadataKeysArray)
|
||||
{
|
||||
metadataKeys.add(metadataKey.trim());
|
||||
}
|
||||
// Create the entry
|
||||
@@ -367,8 +352,7 @@ public abstract class AbstractMetadataExtractor
|
||||
}
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -416,14 +400,14 @@ public abstract class AbstractMetadataExtractor
|
||||
* <li>it is an empty collection</li>
|
||||
* <li>it is an empty array</li>
|
||||
* </ul>
|
||||
* String values are trimmed before being put into the map.
|
||||
* Otherwise, it is up to the extracter to ensure that the value is a <tt>Serializable</tt>.
|
||||
* It is not appropriate to implicitly convert values in order to make them <tt>Serializable</tt>
|
||||
* - the best conversion method will depend on the value's specific meaning.
|
||||
* String values are trimmed before being put into the map. Otherwise, it is up to the extracter to ensure that the value is a <tt>Serializable</tt>. It is not appropriate to implicitly convert values in order to make them <tt>Serializable</tt> - the best conversion method will depend on the value's specific meaning.
|
||||
*
|
||||
* @param key the destination key
|
||||
* @param value the serializable value
|
||||
* @param destination the map to put values into
|
||||
* @param key
|
||||
* the destination key
|
||||
* @param value
|
||||
* the serializable value
|
||||
* @param destination
|
||||
* the map to put values into
|
||||
* @return Returns <tt>true</tt> if set, otherwise <tt>false</tt>
|
||||
*/
|
||||
// Copied from the content repository's AbstractMappingMetadataExtracter.
|
||||
@@ -471,8 +455,7 @@ public abstract class AbstractMetadataExtractor
|
||||
}
|
||||
|
||||
/**
|
||||
* The {@code transformOptions} may contain a replacement set of mappings. These will be used in place of the
|
||||
* default mappings from read from file if supplied.
|
||||
* The {@code transformOptions} may contain a replacement set of mappings. These will be used in place of the default mappings from read from file if supplied.
|
||||
*/
|
||||
public void extractMetadata(String sourceMimetype, Map<String, String> transformOptions, File sourceFile,
|
||||
File targetFile) throws Exception
|
||||
@@ -493,8 +476,7 @@ public abstract class AbstractMetadataExtractor
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Set<String>> getExtractMappingFromOptions(Map<String, String> transformOptions, Map<String,
|
||||
Set<String>> defaultExtractMapping)
|
||||
private Map<String, Set<String>> getExtractMappingFromOptions(Map<String, String> transformOptions, Map<String, Set<String>> defaultExtractMapping)
|
||||
{
|
||||
String extractMappingOption = transformOptions.get(EXTRACT_MAPPING);
|
||||
if (extractMappingOption != null)
|
||||
@@ -513,8 +495,7 @@ public abstract class AbstractMetadataExtractor
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #extractMetadata(String, Map, File, File)} rather than calling this method.
|
||||
* By default call the overloaded method with the default {@code extractMapping}.
|
||||
* @deprecated use {@link #extractMetadata(String, Map, File, File)} rather than calling this method. By default call the overloaded method with the default {@code extractMapping}.
|
||||
*/
|
||||
@Deprecated
|
||||
public void mapMetadataAndWrite(File targetFile, Map<String, Serializable> metadata) throws IOException
|
||||
@@ -538,8 +519,10 @@ public abstract class AbstractMetadataExtractor
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#mapRawToSystem.
|
||||
*
|
||||
* @param rawMetadata Metadata keyed by document properties
|
||||
* @param extractMapping Mapping between document ans system properties
|
||||
* @param rawMetadata
|
||||
* Metadata keyed by document properties
|
||||
* @param extractMapping
|
||||
* Mapping between document ans system properties
|
||||
* @return Returns the metadata keyed by the system properties
|
||||
*/
|
||||
private Map<String, Serializable> mapRawToSystem(Map<String, Serializable> rawMetadata,
|
||||
|
||||
+6
-3
@@ -40,7 +40,8 @@ public class FileRefEntity
|
||||
{
|
||||
private String fileRef;
|
||||
|
||||
public FileRefEntity() {}
|
||||
public FileRefEntity()
|
||||
{}
|
||||
|
||||
public FileRefEntity(String fileRef)
|
||||
{
|
||||
@@ -60,8 +61,10 @@ public class FileRefEntity
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
FileRefEntity that = (FileRefEntity) o;
|
||||
return Objects.equals(fileRef, that.fileRef);
|
||||
}
|
||||
|
||||
+2
-1
@@ -38,7 +38,8 @@ public class FileRefResponse
|
||||
{
|
||||
private FileRefEntity entry;
|
||||
|
||||
public FileRefResponse() {}
|
||||
public FileRefResponse()
|
||||
{}
|
||||
|
||||
public FileRefResponse(FileRefEntity entry)
|
||||
{
|
||||
|
||||
+29
-31
@@ -26,14 +26,15 @@
|
||||
*/
|
||||
package org.alfresco.transformer.probes;
|
||||
|
||||
import static org.alfresco.transformer.fs.FileManager.SOURCE_FILE;
|
||||
import static org.alfresco.transformer.fs.FileManager.TARGET_FILE;
|
||||
import static org.alfresco.transformer.fs.FileManager.TempFileProvider.createTempFile;
|
||||
import static org.springframework.http.HttpStatus.INSUFFICIENT_STORAGE;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS;
|
||||
|
||||
import static org.alfresco.transformer.fs.FileManager.SOURCE_FILE;
|
||||
import static org.alfresco.transformer.fs.FileManager.TARGET_FILE;
|
||||
import static org.alfresco.transformer.fs.FileManager.TempFileProvider.createTempFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -41,35 +42,30 @@ import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.AbstractTransformerController;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Provides the logic performing test transformations by the live and ready probes.
|
||||
*
|
||||
* <p><b>K8s probes</b>: A readiness probe indicates if the pod should accept request. <b>It does not indicate that a pod is
|
||||
* ready after startup</b>. The liveness probe indicates when to kill the pod. <b>Both probes are called throughout the
|
||||
* lifetime of the pod</b> and a <b>liveness probes can take place before a readiness probe.</b> The k8s
|
||||
* <b>initialDelaySeconds field is not fully honoured</b> as it is multiplied by a random number, so is
|
||||
* actually a maximum initial delay in seconds, but could be 0. </p>
|
||||
* <p>
|
||||
* <b>K8s probes</b>: A readiness probe indicates if the pod should accept request. <b>It does not indicate that a pod is ready after startup</b>. The liveness probe indicates when to kill the pod. <b>Both probes are called throughout the lifetime of the pod</b> and a <b>liveness probes can take place before a readiness probe.</b> The k8s <b>initialDelaySeconds field is not fully honoured</b> as it is multiplied by a random number, so is actually a maximum initial delay in seconds, but could be 0.
|
||||
* </p>
|
||||
*
|
||||
* <p>Live and readiness probes might do test transforms. The first 6 requests result in a transformation
|
||||
* of a small test file. The average time is remembered, but excludes the first one which is normally longer. This is
|
||||
* used in future requests to discover if transformations are becoming slower. The request also returns a non 200 status
|
||||
* code resulting in the k8s pod being terminated, after a predefined number of transformations have been performed or
|
||||
* if any transformation takes a long time. These are controlled by environment variables:</p>
|
||||
* <p>
|
||||
* Live and readiness probes might do test transforms. The first 6 requests result in a transformation of a small test file. The average time is remembered, but excludes the first one which is normally longer. This is used in future requests to discover if transformations are becoming slower. The request also returns a non 200 status code resulting in the k8s pod being terminated, after a predefined number of transformations have been performed or if any transformation takes a long time. These are controlled by environment variables:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>livenessPercent - The percentage slower the small test transform must be to indicate there is a problem.</li>
|
||||
* <li>livenessTransformPeriodSeconds - As liveness probes should be frequent, not every request should result in
|
||||
* a test transformation. This value defines the gap between transformations.</li>
|
||||
* <li>livenessTransformPeriodSeconds - As liveness probes should be frequent, not every request should result in a test transformation. This value defines the gap between transformations.</li>
|
||||
* <li>maxTransforms - the maximum number of transformation to be performed before a restart.</li>
|
||||
* <li>maxTransformSeconds - the maximum time for a transformation, including failed ones.</li>
|
||||
* </ul>
|
||||
@@ -115,13 +111,18 @@ public abstract class ProbeTestTransform
|
||||
/**
|
||||
* See Probes.md for more info.
|
||||
*
|
||||
* @param expectedLength was the length of the target file during testing
|
||||
* @param plusOrMinus simply allows for some variation in the transformed size caused by new versions of dates
|
||||
* @param livenessPercent indicates that for this type of transform a variation up to 2 and a half times is not
|
||||
* unreasonable under load
|
||||
* @param maxTransforms default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
* @param maxTransformSeconds default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
* @param livenessTransformPeriodSeconds default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
* @param expectedLength
|
||||
* was the length of the target file during testing
|
||||
* @param plusOrMinus
|
||||
* simply allows for some variation in the transformed size caused by new versions of dates
|
||||
* @param livenessPercent
|
||||
* indicates that for this type of transform a variation up to 2 and a half times is not unreasonable under load
|
||||
* @param maxTransforms
|
||||
* default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
* @param maxTransformSeconds
|
||||
* default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
* @param livenessTransformPeriodSeconds
|
||||
* default values normally supplied by helm. Not identical so we can be sure which value is used.
|
||||
*/
|
||||
public ProbeTestTransform(AbstractTransformerController controller,
|
||||
String sourceFilename, String targetFilename, long expectedLength, long plusOrMinus,
|
||||
@@ -148,8 +149,7 @@ public abstract class ProbeTestTransform
|
||||
return Boolean.parseBoolean(System.getenv(name));
|
||||
}
|
||||
catch (Exception ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@@ -164,8 +164,7 @@ public abstract class ProbeTestTransform
|
||||
l = Long.parseLong(env);
|
||||
}
|
||||
catch (NumberFormatException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
if (l <= 0)
|
||||
{
|
||||
@@ -215,8 +214,7 @@ public abstract class ProbeTestTransform
|
||||
do
|
||||
{
|
||||
nextTransformTime += livenessTransformPeriod;
|
||||
}
|
||||
while (nextTransformTime < start);
|
||||
} while (nextTransformTime < start);
|
||||
}
|
||||
|
||||
File sourceFile = getSourceFile(request, isLiveProbe);
|
||||
|
||||
+1
-2
@@ -33,5 +33,4 @@ package org.alfresco.transformer.util;
|
||||
*/
|
||||
@Deprecated
|
||||
public interface MimetypeMap extends org.alfresco.transform.common.Mimetype
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ package org.alfresco.transformer.util;
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Extends the list of transform options with historic request parameters or 'extra' parameters used in testing
|
||||
* or communication in the all-in-one transformer.
|
||||
* Extends the list of transform options with historic request parameters or 'extra' parameters used in testing or communication in the all-in-one transformer.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface RequestParamMap extends org.alfresco.transform.client.util.RequestParamMap
|
||||
|
||||
+6
-3
@@ -35,7 +35,8 @@ public class Util
|
||||
/**
|
||||
* Safely converts a {@link String} to an {@link Integer}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Integer}
|
||||
*/
|
||||
public static Integer stringToInteger(final String param)
|
||||
@@ -46,7 +47,8 @@ public class Util
|
||||
/**
|
||||
* Safely converts a {@link String} to a {@link Boolean}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Boolean}
|
||||
*/
|
||||
public static Boolean stringToBoolean(final String param)
|
||||
@@ -57,7 +59,8 @@ public class Util
|
||||
/**
|
||||
* Safely converts a {@link String} to a {@link Long}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Boolean}
|
||||
*/
|
||||
public static Long stringToLong(final String param)
|
||||
|
||||
+4
-4
@@ -26,13 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.springframework.http.HttpMethod.POST;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
import static org.springframework.test.util.AssertionErrors.assertTrue;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -45,8 +46,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* Super class for testing controllers with a server. Includes tests for the AbstractTransformerController itself.
|
||||
* Note: Currently uses json rather than HTML as json is returned by this spring boot test harness.
|
||||
* Super class for testing controllers with a server. Includes tests for the AbstractTransformerController itself. Note: Currently uses json rather than HTML as json is returned by this spring boot test harness.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractHttpRequestTest
|
||||
|
||||
+8
-8
@@ -27,12 +27,14 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.text.MessageFormat.format;
|
||||
import static org.alfresco.transformer.EngineClient.sendTRequest;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_METADATA_EXTRACT;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_METADATA_EXTRACT;
|
||||
import static org.alfresco.transformer.EngineClient.sendTRequest;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -42,7 +44,6 @@ import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@@ -52,11 +53,11 @@ import org.springframework.http.ResponseEntity;
|
||||
* Super class of metadata integration tests. Sub classes should provide the following:
|
||||
* <p>
|
||||
* <ul>
|
||||
* <li>A method providing a
|
||||
* Stream of test files: {@code public static Stream<TestFileInfo> engineTransformations()}; </li>
|
||||
* <li>A method providing a Stream of test files: {@code public static Stream<TestFileInfo> engineTransformations()};</li>
|
||||
* <li>Provide expected json files (<sourceFilename>"_metadata.json") as resources on the classpath.</li>
|
||||
* <li> Override the method {@code testTransformation(TestFileInfo testFileInfo)} such that it calls
|
||||
* the super method as a {@code @ParameterizedTest} for example:</li> </ul>
|
||||
* <li>Override the method {@code testTransformation(TestFileInfo testFileInfo)} such that it calls the super method as a {@code @ParameterizedTest} for example:</li>
|
||||
* </ul>
|
||||
*
|
||||
* <pre>
|
||||
* @ParameterizedTest
|
||||
*
|
||||
@@ -84,7 +85,6 @@ public abstract class AbstractMetadataExtractsIT
|
||||
|
||||
private final ObjectMapper jsonObjectMapper = new ObjectMapper();
|
||||
|
||||
|
||||
public void testTransformation(TestFileInfo testFileInfo)
|
||||
{
|
||||
final String sourceMimetype = testFileInfo.getMimeType();
|
||||
|
||||
+4
-4
@@ -30,19 +30,19 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import jakarta.jms.Queue;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*
|
||||
* @author Lucian Tuca
|
||||
* created on 15/01/2019
|
||||
* @author Lucian Tuca created on 15/01/2019
|
||||
*/
|
||||
@Deprecated
|
||||
@SpringBootTest(properties = {"activemq.url=nio://localhost:61616"})
|
||||
|
||||
+64
-65
@@ -26,38 +26,26 @@
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
import org.alfresco.transform.messages.TransformStack;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.model.FileRefEntity;
|
||||
import org.alfresco.transformer.model.FileRefResponse;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.springframework.http.HttpHeaders.ACCEPT;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG_LATEST;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -70,29 +58,37 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG_LATEST;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.http.HttpHeaders.ACCEPT;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
import org.alfresco.transform.messages.TransformStack;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
@@ -135,8 +131,7 @@ public abstract class AbstractTransformerControllerTest
|
||||
/**
|
||||
* The expected result. Taken resting target quick file's bytes.
|
||||
*
|
||||
* Note: These checks generally don't work on Windows (Mac and Linux are okay). Possibly to do with byte order
|
||||
* loading.
|
||||
* Note: These checks generally don't work on Windows (Mac and Linux are okay). Possibly to do with byte order loading.
|
||||
*/
|
||||
protected byte[] expectedTargetFileBytes;
|
||||
|
||||
@@ -151,14 +146,16 @@ public abstract class AbstractTransformerControllerTest
|
||||
TransformRequest transformRequest);
|
||||
|
||||
/**
|
||||
* This method ends up being the core of the mock.
|
||||
* It copies content from an existing file in the resources folder to the desired location
|
||||
* in order to simulate a successful transformation.
|
||||
* This method ends up being the core of the mock. It copies content from an existing file in the resources folder to the desired location in order to simulate a successful transformation.
|
||||
*
|
||||
* @param actualTargetExtension Requested extension.
|
||||
* @param testFile The test file (transformed) - basically the result.
|
||||
* @param targetFile The location where the content from the testFile should be copied
|
||||
* @throws IOException in case of any errors.
|
||||
* @param actualTargetExtension
|
||||
* Requested extension.
|
||||
* @param testFile
|
||||
* The test file (transformed) - basically the result.
|
||||
* @param targetFile
|
||||
* The location where the content from the testFile should be copied
|
||||
* @throws IOException
|
||||
* in case of any errors.
|
||||
*/
|
||||
void generateTargetFileFromResourceFile(String actualTargetExtension, File testFile,
|
||||
File targetFile) throws IOException
|
||||
@@ -172,7 +169,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
FileChannel target = outputStream.getChannel();
|
||||
target.transferFrom(source, 0, source.size());
|
||||
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
@@ -189,7 +187,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
FileChannel target = outputStream.getChannel();
|
||||
target.transferFrom(source, 0, source.size());
|
||||
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
+3
-1
@@ -8,9 +8,11 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
+5
-4
@@ -40,10 +40,6 @@ import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transformer.messaging.TransformMessageConverter;
|
||||
import org.alfresco.transformer.messaging.TransformReplySender;
|
||||
import org.apache.activemq.command.ActiveMQObjectMessage;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -55,6 +51,11 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transformer.messaging.TransformMessageConverter;
|
||||
import org.alfresco.transformer.messaging.TransformReplySender;
|
||||
|
||||
/**
|
||||
* @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine.
|
||||
*/
|
||||
|
||||
+4
-2
@@ -50,8 +50,10 @@ public class SourceTarget
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
SourceTarget that = (SourceTarget) o;
|
||||
return Objects.equals(source, that.source) &&
|
||||
Objects.equals(target, that.target);
|
||||
|
||||
@@ -26,19 +26,20 @@
|
||||
*/
|
||||
package org.alfresco.transform.coreaio;
|
||||
|
||||
import org.alfresco.transform.base.TransformEngine;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import static org.alfresco.transform.base.logging.StandardMessages.COMMUNITY_LICENCE;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.alfresco.transform.base.logging.StandardMessages.COMMUNITY_LICENCE;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.base.TransformEngine;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
|
||||
@Component
|
||||
public class AIOTransformEngine implements TransformEngine
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.imagemagick.ImageMagickTransformationIT;
|
||||
|
||||
public class AIOImageMagickIT extends ImageMagickTransformationIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -32,5 +32,4 @@ import org.alfresco.transform.imagemagick.ImageMagickTest;
|
||||
* Test ImageMagick functionality in All-In-One.
|
||||
*/
|
||||
public class AIOImageMagickTest extends ImageMagickTest
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -32,5 +32,4 @@ import org.alfresco.transform.libreoffice.LibreOfficeTest;
|
||||
* Test LibreOffice functionality in All-In-One.
|
||||
*/
|
||||
public class AIOLibreOfficeTest extends LibreOfficeTest
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
+1
-2
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.libreoffice.LibreOfficeTransformationIT;
|
||||
|
||||
public class AIOLibreOfficeTransformationIT extends LibreOfficeTransformationIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
+4
-2
@@ -29,9 +29,11 @@ package org.alfresco.transform.aio;
|
||||
|
||||
import org.alfresco.transform.base.LivenessReadinessProbeTest;
|
||||
|
||||
public class AIOLivenessReadinessProbeIT extends LivenessReadinessProbeTest {
|
||||
public class AIOLivenessReadinessProbeIT extends LivenessReadinessProbeTest
|
||||
{
|
||||
@Override
|
||||
protected LivenessReadinessProbeTest.ImagesForTests getImageForTest() {
|
||||
protected LivenessReadinessProbeTest.ImagesForTests getImageForTest()
|
||||
{
|
||||
return new ImagesForTests("alfresco-transform-core-aio", "text/plain", "text/plain", "original.txt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.misc.MiscMetadataExtractsIT;
|
||||
|
||||
public class AIOMiscMetadataExtractsIT extends MiscMetadataExtractsIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -32,5 +32,4 @@ import org.alfresco.transform.misc.MiscTest;
|
||||
* Test Misc functionality in All-In-One.
|
||||
*/
|
||||
public class AIOMiscTest extends MiscTest
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.misc.MiscTransformsIT;
|
||||
|
||||
public class AIOMiscTransformsIT extends MiscTransformsIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.pdfrenderer.PdfRendererTransformationIT;
|
||||
|
||||
public class AIOPdfRendererIT extends PdfRendererTransformationIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -32,5 +32,4 @@ import org.alfresco.transform.pdfrenderer.PdfRendererTest;
|
||||
* Test PdfRenderer functionality in All-In-One.
|
||||
*/
|
||||
public class AIOPdfRendererTest extends PdfRendererTest
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -26,17 +26,16 @@
|
||||
*/
|
||||
package org.alfresco.transform.aio;
|
||||
|
||||
import org.alfresco.transform.base.messaging.AbstractQueueIT;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_HTML;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.alfresco.transform.base.messaging.AbstractQueueIT;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
/**
|
||||
* @author David Edwards
|
||||
* created on 21/04/2020
|
||||
* @author David Edwards created on 21/04/2020
|
||||
*/
|
||||
public class AIOQueueIT extends AbstractQueueIT
|
||||
{
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.tika.TikaMetadataExtractsIT;
|
||||
|
||||
public class AIOTikaMetadataExtractsIT extends TikaMetadataExtractsIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -29,5 +29,4 @@ package org.alfresco.transform.aio;
|
||||
import org.alfresco.transform.tika.TikaTransformationIT;
|
||||
|
||||
public class AIOTikaTransformationIT extends TikaTransformationIT
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
|
||||
|
||||
@@ -26,16 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by transform specific code. The {@code transformerName} should match the transformerName
|
||||
* in the {@link TransformConfig} returned by the {@link TransformEngine}. So that it is automatically picked up, it
|
||||
* must exist in a package under {@code org.alfresco.transform} and have the Spring {@code @Component} annotation.
|
||||
* Interface to be implemented by transform specific code. The {@code transformerName} should match the transformerName in the {@link TransformConfig} returned by the {@link TransformEngine}. So that it is automatically picked up, it must exist in a package under {@code org.alfresco.transform} and have the Spring {@code @Component} annotation.
|
||||
*
|
||||
* Implementations may also use the {@link TransformManager} if they wish to interact with the base t-engine.
|
||||
*/
|
||||
|
||||
@@ -26,15 +26,42 @@
|
||||
*/
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.registry.TransformRegistry;
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import static java.text.MessageFormat.format;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
|
||||
import static org.alfresco.transform.base.html.OptionsHelper.getOptionNames;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION_DEFAULT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_ERROR;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_LIVE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_LOG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_READY;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_ROOT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TEST;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.FILE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.SOURCE_MIMETYPE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.TARGET_MIMETYPE;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setOrClearCoreVersion;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -57,39 +84,14 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static java.text.MessageFormat.format;
|
||||
import static org.alfresco.transform.base.html.OptionsHelper.getOptionNames;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.CONFIG_VERSION_DEFAULT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_ERROR;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_LIVE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_LOG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_READY;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_ROOT;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TEST;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM_CONFIG;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_VERSION;
|
||||
import static org.alfresco.transform.common.RequestParamMap.FILE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.SOURCE_MIMETYPE;
|
||||
import static org.alfresco.transform.common.RequestParamMap.TARGET_MIMETYPE;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setOrClearCoreVersion;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.registry.TransformRegistry;
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Provides the main endpoints into the t-engine.
|
||||
@@ -317,8 +319,7 @@ public class TransformController
|
||||
Map<String, String> requestParameters = new HashMap<>();
|
||||
sourceMimetype = overrideMimetypeFromExtension(origRequestParameters, SOURCE_MIMETYPE, sourceMimetype);
|
||||
targetMimetype = overrideMimetypeFromExtension(origRequestParameters, TARGET_MIMETYPE, targetMimetype);
|
||||
origRequestParameters.forEach((name, value) ->
|
||||
{
|
||||
origRequestParameters.forEach((name, value) -> {
|
||||
if (!name.startsWith("value"))
|
||||
{
|
||||
if (name.startsWith("name"))
|
||||
|
||||
@@ -27,14 +27,11 @@
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.reader.TransformConfigResourceReader;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.reader.TransformConfigResourceReader;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by transform specific code. Provides information about the t-engine as a whole.
|
||||
* Also see {@link CustomTransformer} which provides the code that performs transformation. There may be several
|
||||
* in a single t-engine. So that it is automatically picked up, it must exist in a package under
|
||||
* {@code org.alfresco.transform} and have the Spring {@code @Component} annotation.
|
||||
* Interface to be implemented by transform specific code. Provides information about the t-engine as a whole. Also see {@link CustomTransformer} which provides the code that performs transformation. There may be several in a single t-engine. So that it is automatically picked up, it must exist in a package under {@code org.alfresco.transform} and have the Spring {@code @Component} annotation.
|
||||
*/
|
||||
public interface TransformEngine
|
||||
{
|
||||
@@ -49,10 +46,7 @@ public interface TransformEngine
|
||||
String getStartupMessage();
|
||||
|
||||
/**
|
||||
* @return a definition of what the t-engine supports. Normally read from a json Resource on the classpath using a
|
||||
* {@link TransformConfigResourceReader}. To combine to code from multiple t-engine into a single t-engine
|
||||
* include all the TransformEngines and CustomTransform implementations, plus a wrapper TransformEngine for the
|
||||
* others. The wrapper should return {@code null} from this method.
|
||||
* @return a definition of what the t-engine supports. Normally read from a json Resource on the classpath using a {@link TransformConfigResourceReader}. To combine to code from multiple t-engine into a single t-engine include all the TransformEngines and CustomTransform implementations, plus a wrapper TransformEngine for the others. The wrapper should return {@code null} from this method.
|
||||
*/
|
||||
TransformConfig getTransformConfig();
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Allows {@link CustomTransformer} implementations to interact with the base t-engine.
|
||||
*/
|
||||
@@ -45,42 +45,33 @@ public interface TransformManager
|
||||
String getRequestId();
|
||||
|
||||
/**
|
||||
* Allows a {@link CustomTransformer} to use a local source {@code File} rather than the supplied {@code InputStream}.
|
||||
* The file will be deleted once the request is completed. To avoid creating extra files, if a File has already
|
||||
* been created by the base t-engine, it is returned.
|
||||
* If possible this method should be avoided as it is better not to leave content on disk.
|
||||
* @throws IllegalStateException if this method has already been called.
|
||||
* Allows a {@link CustomTransformer} to use a local source {@code File} rather than the supplied {@code InputStream}. The file will be deleted once the request is completed. To avoid creating extra files, if a File has already been created by the base t-engine, it is returned. If possible this method should be avoided as it is better not to leave content on disk.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* if this method has already been called.
|
||||
*/
|
||||
File createSourceFile() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Allows a {@link CustomTransformer} to use a local target {@code File} rather than the supplied {@code OutputStream}.
|
||||
* The file will be deleted once the request is completed. To avoid creating extra files, if a File has already
|
||||
* been created by the base t-engine, it is returned.
|
||||
* If possible this method should be avoided as it is better not to leave content on disk.
|
||||
* @throws IllegalStateException if this method has already been called. A call to {@link #respondWithFragment(Integer, boolean)}
|
||||
* allows the method to be called again.
|
||||
* Allows a {@link CustomTransformer} to use a local target {@code File} rather than the supplied {@code OutputStream}. The file will be deleted once the request is completed. To avoid creating extra files, if a File has already been created by the base t-engine, it is returned. If possible this method should be avoided as it is better not to leave content on disk.
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* if this method has already been called. A call to {@link #respondWithFragment(Integer, boolean)} allows the method to be called again.
|
||||
*/
|
||||
File createTargetFile() throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* Allows a single transform request to have multiple transform responses. For example, images from a video at
|
||||
* different time offsets or different pages of a document. Following a call to this method a transform response is
|
||||
* made with the data sent to the current {@code OutputStream}. If this method has been called, there will not be
|
||||
* another response when {@link CustomTransformer#transform(String, InputStream, String, OutputStream, Map,
|
||||
* TransformManager)} returns and any data written to the final {@code OutputStream} will be ignored.
|
||||
* @param index returned with the response, so that the fragment may be distinguished from other responses.
|
||||
* Renditions use the index as an offset into elements. A {@code null} value indicates that there
|
||||
* is no more output and any data sent to the current {@code outputStream} will be ignored.
|
||||
* @param finished indicates this is the final fragment. {@code False} indicates that it is expected there will be
|
||||
* more fragments. There need not be a call with this parameter set to {@code true}.
|
||||
* @return a new {@code OutputStream} for the next fragment. A {@code null} will be returned if {@code index} was
|
||||
* {@code null} or {@code finished} was {@code true}.
|
||||
* @throws TransformException if a synchronous (http) request has been made as this only works with requests
|
||||
* on queues, or the first call to this method indicated there was no output, or
|
||||
* another call is made after it has been indicated that there should be no more
|
||||
* fragments.
|
||||
* @throws IOException if there was a problem sending the response.
|
||||
* Allows a single transform request to have multiple transform responses. For example, images from a video at different time offsets or different pages of a document. Following a call to this method a transform response is made with the data sent to the current {@code OutputStream}. If this method has been called, there will not be another response when {@link CustomTransformer#transform(String, InputStream, String, OutputStream, Map, TransformManager)} returns and any data written to the final {@code OutputStream} will be ignored.
|
||||
*
|
||||
* @param index
|
||||
* returned with the response, so that the fragment may be distinguished from other responses. Renditions use the index as an offset into elements. A {@code null} value indicates that there is no more output and any data sent to the current {@code outputStream} will be ignored.
|
||||
* @param finished
|
||||
* indicates this is the final fragment. {@code False} indicates that it is expected there will be more fragments. There need not be a call with this parameter set to {@code true}.
|
||||
* @return a new {@code OutputStream} for the next fragment. A {@code null} will be returned if {@code index} was {@code null} or {@code finished} was {@code true}.
|
||||
* @throws TransformException
|
||||
* if a synchronous (http) request has been made as this only works with requests on queues, or the first call to this method indicated there was no output, or another call is made after it has been indicated that there should be no more fragments.
|
||||
* @throws IOException
|
||||
* if there was a problem sending the response.
|
||||
*/
|
||||
// This works because all the state is in the TransformResponse and the t-router will just see each response as
|
||||
// something to either return to the client or pass to the next stage in a pipeline. We might be able to enhance
|
||||
|
||||
@@ -26,7 +26,15 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.config;
|
||||
|
||||
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
@@ -52,17 +60,11 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.http.client.reactive.JettyClientHttpConnector;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
||||
|
||||
@Configuration
|
||||
public class MTLSConfig {
|
||||
public class MTLSConfig
|
||||
{
|
||||
|
||||
@Value("${client.ssl.key-store:#{null}}")
|
||||
private Resource keyStoreResource;
|
||||
@@ -106,13 +108,16 @@ public class MTLSConfig {
|
||||
if (isTlsOrMtlsConfigured())
|
||||
{
|
||||
return createRestTemplateWithSslContext(sslContextBuilder);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return new RestTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SSLContextBuilder sslContextBuilder() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
|
||||
public SSLContextBuilder sslContextBuilder() throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException
|
||||
{
|
||||
SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
|
||||
if (isKeystoreConfigured())
|
||||
{
|
||||
@@ -156,18 +161,18 @@ public class MTLSConfig {
|
||||
return keyStoreResource != null;
|
||||
}
|
||||
|
||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||
SSLConnectionSocketFactoryBuilder.create()
|
||||
private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException
|
||||
{
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = SSLConnectionSocketFactoryBuilder.create()
|
||||
.setSslContext(sslContextBuilder.build())
|
||||
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||
if (hostNameVerificationDisabled) {
|
||||
if (hostNameVerificationDisabled)
|
||||
{
|
||||
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||
}
|
||||
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
.register("https", sslConnectionSocketFactory)
|
||||
.build();
|
||||
|
||||
|
||||
+10
-9
@@ -26,10 +26,12 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.config;
|
||||
|
||||
import org.alfresco.transform.base.html.TransformInterceptor;
|
||||
import org.alfresco.transform.base.registry.TransformConfigSource;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.config.CoreFunction.standardizeCoreVersion;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@@ -38,11 +40,10 @@ import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.alfresco.transform.config.CoreFunction.standardizeCoreVersion;
|
||||
import org.alfresco.transform.base.html.TransformInterceptor;
|
||||
import org.alfresco.transform.base.registry.TransformConfigSource;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(
|
||||
|
||||
+2
-1
@@ -26,10 +26,11 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.executors;
|
||||
|
||||
import static org.alfresco.transform.base.executors.RuntimeExec.ExecutionResult;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import static org.alfresco.transform.base.executors.RuntimeExec.ExecutionResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
+2
-2
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.executors;
|
||||
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
|
||||
/**
|
||||
* Basic interface for executing transformations via Shell commands
|
||||
*
|
||||
|
||||
+20
-27
@@ -35,24 +35,17 @@ import java.util.Objects;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* This class is used to tokenize strings used as parameters for {@link RuntimeExec} objects.
|
||||
* Examples of such strings are as follows (ImageMagick-like parameters):
|
||||
* This class is used to tokenize strings used as parameters for {@link RuntimeExec} objects. Examples of such strings are as follows (ImageMagick-like parameters):
|
||||
* <ul>
|
||||
* <li><tt>-font Helvetica -pointsize 50</tt></li>
|
||||
* <li><tt>-font Helvetica -pointsize 50 -draw "circle 100,100 150,150"</tt></li>
|
||||
* <li><tt>-font Helvetica -pointsize 50 -draw "gravity south fill black text 0,12 'CopyRight'"</tt></li>
|
||||
* </ul>
|
||||
* The first is the simple case which would be parsed into Strings as follows:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50"</tt>
|
||||
* The first is the simple case which would be parsed into Strings as follows: <tt>"-font", "Helvetica", "-pointsize", "50"</tt>
|
||||
* <p/>
|
||||
* The second is more complex in that it includes a quoted parameter, which would be parsed as a single String:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50", "circle 100,100 150,150"</tt>
|
||||
* Note however that the quotation characters will be stripped from the token.
|
||||
* The second is more complex in that it includes a quoted parameter, which would be parsed as a single String: <tt>"-font", "Helvetica", "-pointsize", "50", "circle 100,100 150,150"</tt> Note however that the quotation characters will be stripped from the token.
|
||||
* <p/>
|
||||
* The third shows an example with embedded quotation marks, which would parse to:
|
||||
* <tt>"-font", "Helvetica", "-pointsize", "50", "gravity south fill black text 0,12 'CopyRight'"</tt>
|
||||
* In this case, the embedded quotation marks (which must be different from those surrounding the parameter)
|
||||
* are preserved in the extracted token.
|
||||
* The third shows an example with embedded quotation marks, which would parse to: <tt>"-font", "Helvetica", "-pointsize", "50", "gravity south fill black text 0,12 'CopyRight'"</tt> In this case, the embedded quotation marks (which must be different from those surrounding the parameter) are preserved in the extracted token.
|
||||
* <p/>
|
||||
* The class does not understand escaped quotes such as <tt>p1 p2 "a b c \"hello\" d" p4</tt>
|
||||
*
|
||||
@@ -77,15 +70,12 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the tokens in a parameter string.
|
||||
* Any tokens not contained within single or double quotes will be tokenized in the normal
|
||||
* way i.e. by using whitespace separators and the standard StringTokenizer algorithm.
|
||||
* Any tokens which are contained within single or double quotes will be returned as single
|
||||
* String instances and will have their quote marks removed.
|
||||
* This method returns the tokens in a parameter string. Any tokens not contained within single or double quotes will be tokenized in the normal way i.e. by using whitespace separators and the standard StringTokenizer algorithm. Any tokens which are contained within single or double quotes will be returned as single String instances and will have their quote marks removed.
|
||||
* <p/>
|
||||
* See above for examples.
|
||||
*
|
||||
* @throws NullPointerException if the string to be tokenized was null.
|
||||
* @throws NullPointerException
|
||||
* if the string to be tokenized was null.
|
||||
*/
|
||||
public List<String> getAllTokens()
|
||||
{
|
||||
@@ -135,9 +125,7 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
|
||||
/**
|
||||
* The substrings will be a list of quoted and unquoted substrings.
|
||||
* The unquoted ones need to be further tokenized in the normal way.
|
||||
* The quoted ones must not be tokenized, but need their quotes stripped off.
|
||||
* The substrings will be a list of quoted and unquoted substrings. The unquoted ones need to be further tokenized in the normal way. The quoted ones must not be tokenized, but need their quotes stripped off.
|
||||
*/
|
||||
private List<Substring> getSubstrings(String str,
|
||||
List<Pair<Integer, Integer>> quotedRegionIndices)
|
||||
@@ -295,8 +283,10 @@ public class ExecParameterTokenizer
|
||||
/**
|
||||
* Make a new one.
|
||||
*
|
||||
* @param first The first member.
|
||||
* @param second The second member.
|
||||
* @param first
|
||||
* The first member.
|
||||
* @param second
|
||||
* The second member.
|
||||
*/
|
||||
public Pair(F first, S second)
|
||||
{
|
||||
@@ -334,16 +324,20 @@ public class ExecParameterTokenizer
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object o)
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Pair<?, ?> pair = (Pair<?, ?>) o;
|
||||
return Objects.equals(first, pair.first) &&
|
||||
Objects.equals(second, pair.second);
|
||||
}
|
||||
|
||||
@Override public int hashCode()
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(first, second);
|
||||
}
|
||||
@@ -355,4 +349,3 @@ public class ExecParameterTokenizer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+96
-126
@@ -50,51 +50,50 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* This acts as a session similar to the <code>java.lang.Process</code>, but
|
||||
* logs the system standard and error streams.
|
||||
* This acts as a session similar to the <code>java.lang.Process</code>, but logs the system standard and error streams.
|
||||
* <p>
|
||||
* The bean can be configured to execute a command directly, or be given a map
|
||||
* of commands keyed by the <i>os.name</i> Java system property. In this map,
|
||||
* the default key that is used when no match is found is the
|
||||
* <b>{@link #KEY_OS_DEFAULT *}</b> key.
|
||||
* The bean can be configured to execute a command directly, or be given a map of commands keyed by the <i>os.name</i> Java system property. In this map, the default key that is used when no match is found is the <b>{@link #KEY_OS_DEFAULT *}</b> key.
|
||||
* <p>
|
||||
* Use the {@link #setProcessDirectory(String) processDirectory} property to change the default location
|
||||
* from which the command executes. The process's environment can be configured using the
|
||||
* {@link #setProcessProperties(Map) processProperties} property.
|
||||
* Use the {@link #setProcessDirectory(String) processDirectory} property to change the default location from which the command executes. The process's environment can be configured using the {@link #setProcessProperties(Map) processProperties} property.
|
||||
* <p>
|
||||
* Commands may use placeholders, e.g.
|
||||
* <pre><code>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* find
|
||||
* -name
|
||||
* ${filename}
|
||||
* </code></pre>
|
||||
* The <b>filename</b> property will be substituted for any supplied value prior to
|
||||
* each execution of the command. Currently, no checks are made to get or check the
|
||||
* properties contained within the command string. It is up to the client code to
|
||||
* dynamically extract the properties required if the required properties are not
|
||||
* known up front.
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* The <b>filename</b> property will be substituted for any supplied value prior to each execution of the command. Currently, no checks are made to get or check the properties contained within the command string. It is up to the client code to dynamically extract the properties required if the required properties are not known up front.
|
||||
* <p>
|
||||
* Sometimes, a variable may contain several arguments. . In this case, the arguments
|
||||
* need to be tokenized using a standard <tt>StringTokenizer</tt>. To force tokenization
|
||||
* of a value, use:
|
||||
* <pre><code>
|
||||
* Sometimes, a variable may contain several arguments. . In this case, the arguments need to be tokenized using a standard <tt>StringTokenizer</tt>. To force tokenization of a value, use:
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* SPLIT:${userArgs}
|
||||
* </code></pre>
|
||||
* You should not use this just to split up arguments that are known to require tokenization
|
||||
* up front. The <b>SPLIT:</b> directive works for the entire argument and will not do anything
|
||||
* if it is not at the beginning of the argument. Do not use <b>SPLIT:</b> to break up arguments
|
||||
* that are fixed, so avoid doing this:
|
||||
* <pre><code>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* You should not use this just to split up arguments that are known to require tokenization up front. The <b>SPLIT:</b> directive works for the entire argument and will not do anything if it is not at the beginning of the argument. Do not use <b>SPLIT:</b> to break up arguments that are fixed, so avoid doing this:
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* SPLIT:ls -lih
|
||||
* </code></pre>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* Instead, break the command up explicitly:
|
||||
* <pre><code>
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* ls
|
||||
* -lih
|
||||
* </code></pre>
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
* Tokenization of quoted parameter values is handled by ExecParameterTokenizer, which
|
||||
* describes the support in more detail.
|
||||
* Tokenization of quoted parameter values is handled by ExecParameterTokenizer, which describes the support in more detail.
|
||||
*
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
@@ -159,7 +158,8 @@ public class RuntimeExec
|
||||
/**
|
||||
* Set the command to execute regardless of operating system
|
||||
*
|
||||
* @param command an array of strings representing the command (first entry) and arguments
|
||||
* @param command
|
||||
* an array of strings representing the command (first entry) and arguments
|
||||
* @since 3.0
|
||||
*/
|
||||
public void setCommand(String[] command)
|
||||
@@ -168,11 +168,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the assumed charset of OUT and ERR streams generated by the executed command.
|
||||
* This defaults to the system default charset: {@link Charset#defaultCharset()}.
|
||||
* Sets the assumed charset of OUT and ERR streams generated by the executed command. This defaults to the system default charset: {@link Charset#defaultCharset()}.
|
||||
*
|
||||
* @param charsetCode a supported character set code
|
||||
* @throws UnsupportedCharsetException if the characterset code is not recognised by Java
|
||||
* @param charsetCode
|
||||
* a supported character set code
|
||||
* @throws UnsupportedCharsetException
|
||||
* if the characterset code is not recognised by Java
|
||||
*/
|
||||
public void setCharset(String charsetCode)
|
||||
{
|
||||
@@ -180,14 +181,10 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to wait for completion of the command or not. If there is no wait for completion,
|
||||
* then the return value of <i>out</i> and <i>err</i> buffers cannot be relied upon as the
|
||||
* command may still be in progress. Failure is therefore not possible unless the calling thread
|
||||
* waits for execution.
|
||||
* Set whether to wait for completion of the command or not. If there is no wait for completion, then the return value of <i>out</i> and <i>err</i> buffers cannot be relied upon as the command may still be in progress. Failure is therefore not possible unless the calling thread waits for execution.
|
||||
*
|
||||
* @param waitForCompletion <tt>true</tt> (default) is to wait for the command to exit,
|
||||
* or <tt>false</tt> to just return an exit code of 0 and whatever
|
||||
* output is available at that point.
|
||||
* @param waitForCompletion
|
||||
* <tt>true</tt> (default) is to wait for the command to exit, or <tt>false</tt> to just return an exit code of 0 and whatever output is available at that point.
|
||||
* @since 2.1
|
||||
*/
|
||||
public void setWaitForCompletion(boolean waitForCompletion)
|
||||
@@ -196,26 +193,17 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system
|
||||
* property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used
|
||||
* to get a command where there is not direct match to the operating system key.
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used to get a command where there is not direct match to the operating system key.
|
||||
* <p>
|
||||
* Each command is an array of strings, the first of which represents the command and all subsequent
|
||||
* entries in the array represent the arguments. All elements of the array will be checked for
|
||||
* the presence of any substitution parameters (e.g. '{dir}'). The parameters can be set using the
|
||||
* {@link #setDefaultProperties(Map) defaults} or by passing the substitution values into the
|
||||
* {@link #execute(Map)} command.
|
||||
* Each command is an array of strings, the first of which represents the command and all subsequent entries in the array represent the arguments. All elements of the array will be checked for the presence of any substitution parameters (e.g. '{dir}'). The parameters can be set using the {@link #setDefaultProperties(Map) defaults} or by passing the substitution values into the {@link #execute(Map)} command.
|
||||
* <p>
|
||||
* If parameters passed may be multiple arguments, or if the values provided in the map are themselves
|
||||
* collections of arguments (not recommended), then prefix the value with <b>SPLIT:</b> to ensure that
|
||||
* the value is tokenized before being passed to the command. Any values that are not split, will be
|
||||
* passed to the command as single arguments. For example:<br>
|
||||
* If parameters passed may be multiple arguments, or if the values provided in the map are themselves collections of arguments (not recommended), then prefix the value with <b>SPLIT:</b> to ensure that the value is tokenized before being passed to the command. Any values that are not split, will be passed to the command as single arguments. For example:<br>
|
||||
* '<b>SPLIT: dir . ..</b>' becomes '<b>dir</b>', '<b>.</b>' and '<b>..</b>'.<br>
|
||||
* '<b>SPLIT: dir ${path}</b>' (if path is '<b>. ..</b>') becomes '<b>dir</b>', '<b>.</b>' and '<b>..</b>'.<br>
|
||||
* The splitting occurs post-subtitution. Where the arguments are known, it is advisable to avoid
|
||||
* <b>SPLIT:</b>.
|
||||
* The splitting occurs post-subtitution. Where the arguments are known, it is advisable to avoid <b>SPLIT:</b>.
|
||||
*
|
||||
* @param commandsByOS a map of command string arrays, keyed by operating system names
|
||||
* @param commandsByOS
|
||||
* a map of command string arrays, keyed by operating system names
|
||||
* @see #setDefaultProperties(Map)
|
||||
* @since 3.0
|
||||
*/
|
||||
@@ -259,11 +247,10 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system
|
||||
* property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used
|
||||
* to get a command where there is not direct match to the operating system key.
|
||||
* Supply a choice of commands to execute based on a mapping from the <i>os.name</i> system property to the command to execute. The {@link #KEY_OS_DEFAULT *} key can be used to get a command where there is not direct match to the operating system key.
|
||||
*
|
||||
* @param commandsByOS a map of command string keyed by operating system names
|
||||
* @param commandsByOS
|
||||
* a map of command string keyed by operating system names
|
||||
* @deprecated Use {@link #setCommandsAndArguments(Map)}
|
||||
*/
|
||||
public void setCommandMap(Map<String, String> commandsByOS)
|
||||
@@ -289,14 +276,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default command-line properties to use when executing the command.
|
||||
* These are properties that substitute variables defined in the command string itself.
|
||||
* Properties supplied during execution will overwrite the default properties.
|
||||
* Set the default command-line properties to use when executing the command. These are properties that substitute variables defined in the command string itself. Properties supplied during execution will overwrite the default properties.
|
||||
* <p>
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
*
|
||||
* @param defaultProperties property values
|
||||
* @param defaultProperties
|
||||
* property values
|
||||
*/
|
||||
public void setDefaultProperties(Map<String, String> defaultProperties)
|
||||
{
|
||||
@@ -304,14 +289,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Set additional runtime properties (environment properties) that will used
|
||||
* by the executing process.
|
||||
* Set additional runtime properties (environment properties) that will used by the executing process.
|
||||
* <p>
|
||||
* Any keys or properties that start and end with <b>${...}</b> will be removed on the assumption
|
||||
* that these are unset properties. <tt>null</tt> values are translated to empty strings.
|
||||
* All keys and values are trimmed of leading and trailing whitespace.
|
||||
* Any keys or properties that start and end with <b>${...}</b> will be removed on the assumption that these are unset properties. <tt>null</tt> values are translated to empty strings. All keys and values are trimmed of leading and trailing whitespace.
|
||||
*
|
||||
* @param processProperties Runtime process properties
|
||||
* @param processProperties
|
||||
* Runtime process properties
|
||||
* @see Runtime#exec(String, String[], java.io.File)
|
||||
*/
|
||||
public void setProcessProperties(Map<String, String> processProperties)
|
||||
@@ -368,13 +351,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a property to existed processProperties.
|
||||
* Property should not be null or empty.
|
||||
* If property with the same value already exists then no change is made.
|
||||
* If property exists with a different value then old value is replaced with the new one.
|
||||
* Adds a property to existed processProperties. Property should not be null or empty. If property with the same value already exists then no change is made. If property exists with a different value then old value is replaced with the new one.
|
||||
*
|
||||
* @param name - property name
|
||||
* @param value - property value
|
||||
* @param name
|
||||
* - property name
|
||||
* @param value
|
||||
* - property value
|
||||
*/
|
||||
public void setProcessProperty(String name, String value)
|
||||
{
|
||||
@@ -424,10 +406,10 @@ public class RuntimeExec
|
||||
/**
|
||||
* Set the runtime location from which the command is executed.
|
||||
* <p>
|
||||
* If the value is an unsubsititued variable (<b>${...}</b>) then it is ignored.
|
||||
* If the location is not visible at the time of setting, a warning is issued only.
|
||||
* If the value is an unsubsititued variable (<b>${...}</b>) then it is ignored. If the location is not visible at the time of setting, a warning is issued only.
|
||||
*
|
||||
* @param processDirectory the runtime location from which to execute the command
|
||||
* @param processDirectory
|
||||
* the runtime location from which to execute the command
|
||||
*/
|
||||
public void setProcessDirectory(String processDirectory)
|
||||
{
|
||||
@@ -442,16 +424,17 @@ public class RuntimeExec
|
||||
{
|
||||
logger.warn(
|
||||
"The runtime process directory is not visible when setting property " +
|
||||
"'processDirectory': \n{}", this);
|
||||
"'processDirectory': \n{}",
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A comma or space separated list of values that, if returned by the executed command,
|
||||
* indicate an error value. This defaults to <b>"1, 2"</b>.
|
||||
* A comma or space separated list of values that, if returned by the executed command, indicate an error value. This defaults to <b>"1, 2"</b>.
|
||||
*
|
||||
* @param errCodesStr the error codes for the execution
|
||||
* @param errCodesStr
|
||||
* the error codes for the execution
|
||||
*/
|
||||
public void setErrorCodes(String errCodesStr)
|
||||
{
|
||||
@@ -487,9 +470,8 @@ public class RuntimeExec
|
||||
/**
|
||||
* Executes the statement that this instance was constructed with.
|
||||
*
|
||||
* @param properties the properties that the command might be executed with.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* @param properties
|
||||
* the properties that the command might be executed with. <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
* @return Returns the full execution results
|
||||
*/
|
||||
public ExecutionResult execute(Map<String, String> properties)
|
||||
@@ -498,15 +480,12 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the statement that this instance was constructed with an optional
|
||||
* timeout after which the command is asked to
|
||||
* Executes the statement that this instance was constructed with an optional timeout after which the command is asked to
|
||||
*
|
||||
* @param properties the properties that the command might be executed with.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* @param timeoutMs a timeout after which {@link Process#destroy()} is called.
|
||||
* ignored if less than or equal to zero. Note this method does not guarantee
|
||||
* to terminate the process (it is not a kill -9).
|
||||
* @param properties
|
||||
* the properties that the command might be executed with. <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
* @param timeoutMs
|
||||
* a timeout after which {@link Process#destroy()} is called. ignored if less than or equal to zero. Note this method does not guarantee to terminate the process (it is not a kill -9).
|
||||
* @return Returns the full execution results
|
||||
*/
|
||||
public ExecutionResult execute(Map<String, String> properties, final long timeoutMs)
|
||||
@@ -533,8 +512,7 @@ public class RuntimeExec
|
||||
if (timeoutMs > 0)
|
||||
{
|
||||
final String[] command = commandToExecute;
|
||||
timer.schedule(new TimerTask()
|
||||
{
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
@@ -650,8 +628,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the command that will be executed if no additional properties
|
||||
* were to be supplied
|
||||
* @return Returns the command that will be executed if no additional properties were to be supplied
|
||||
*/
|
||||
public String[] getCommand()
|
||||
{
|
||||
@@ -661,12 +638,11 @@ public class RuntimeExec
|
||||
/**
|
||||
* Get the command that will be executed post substitution.
|
||||
* <p>
|
||||
* <code>null</code> properties will be treated as an empty string for substitution
|
||||
* purposes.
|
||||
* <code>null</code> properties will be treated as an empty string for substitution purposes.
|
||||
*
|
||||
* @param properties the properties that the command might be executed with
|
||||
* @return Returns the command that will be executed should the additional properties
|
||||
* be supplied
|
||||
* @param properties
|
||||
* the properties that the command might be executed with
|
||||
* @return Returns the command that will be executed should the additional properties be supplied
|
||||
*/
|
||||
public String[] getCommand(Map<String, String> properties)
|
||||
{
|
||||
@@ -743,7 +719,8 @@ public class RuntimeExec
|
||||
private final String stdErr;
|
||||
|
||||
/**
|
||||
* @param process the process attached to Java - <tt>null</tt> is allowed
|
||||
* @param process
|
||||
* the process attached to Java - <tt>null</tt> is allowed
|
||||
*/
|
||||
private ExecutionResult(
|
||||
final Process process,
|
||||
@@ -780,9 +757,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the command in a form that make running from the command line simpler.
|
||||
* It is not a real attempt at making a command given all the operating system
|
||||
* and shell options, but makes copy, paste and edit a bit simpler.
|
||||
* Appends the command in a form that make running from the command line simpler. It is not a real attempt at making a command given all the operating system and shell options, but makes copy, paste and edit a bit simpler.
|
||||
*/
|
||||
private StringBuilder appendCommand(StringBuilder sb, String[] command)
|
||||
{
|
||||
@@ -818,10 +793,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper method to force a kill of the process that generated this result. This is
|
||||
* useful in cases where the process started is not expected to exit, or doesn't exit
|
||||
* quickly. If the {@linkplain RuntimeExec#setWaitForCompletion(boolean) "wait for completion"}
|
||||
* flag is <tt>false</tt> then the process may still be running when this result is returned.
|
||||
* A helper method to force a kill of the process that generated this result. This is useful in cases where the process started is not expected to exit, or doesn't exit quickly. If the {@linkplain RuntimeExec#setWaitForCompletion(boolean) "wait for completion"} flag is <tt>false</tt> then the process may still be running when this result is returned.
|
||||
*
|
||||
* @return <tt>true</tt> if the process was killed, otherwise <tt>false</tt>
|
||||
*/
|
||||
@@ -844,7 +816,8 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exitValue the command exit value
|
||||
* @param exitValue
|
||||
* the command exit value
|
||||
* @return Returns true if the code is a listed failure code
|
||||
* @see #setErrorCodes(String)
|
||||
*/
|
||||
@@ -854,8 +827,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns true if the command was deemed to be successful according to the
|
||||
* failure codes returned by the execution.
|
||||
* @return Returns true if the command was deemed to be successful according to the failure codes returned by the execution.
|
||||
*/
|
||||
public boolean getSuccess()
|
||||
{
|
||||
@@ -879,8 +851,7 @@ public class RuntimeExec
|
||||
}
|
||||
|
||||
/**
|
||||
* Gobbles an <code>InputStream</code> and writes it into a
|
||||
* <code>StringBuffer</code>
|
||||
* Gobbles an <code>InputStream</code> and writes it into a <code>StringBuffer</code>
|
||||
* <p>
|
||||
* The reading of the input stream is buffered.
|
||||
*/
|
||||
@@ -892,8 +863,8 @@ public class RuntimeExec
|
||||
private boolean completed;
|
||||
|
||||
/**
|
||||
* @param is an input stream to read - it will be wrapped in a buffer
|
||||
* for reading
|
||||
* @param is
|
||||
* an input stream to read - it will be wrapped in a buffer for reading
|
||||
*/
|
||||
public InputStreamReaderThread(InputStream is, Charset charset)
|
||||
{
|
||||
@@ -954,13 +925,13 @@ public class RuntimeExec
|
||||
this.wait(1000L); // 200 ms
|
||||
}
|
||||
catch (InterruptedException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param msg the message to add to the buffer
|
||||
* @param msg
|
||||
* the message to add to the buffer
|
||||
*/
|
||||
public void addToBuffer(String msg)
|
||||
{
|
||||
@@ -981,4 +952,3 @@ public class RuntimeExec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,15 +26,16 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.html;
|
||||
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
|
||||
/**
|
||||
* Used in the html test page, which provides a list of known transform option names.
|
||||
*/
|
||||
@@ -42,14 +43,12 @@ import java.util.TreeSet;
|
||||
public class OptionsHelper
|
||||
{
|
||||
private OptionsHelper()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
public static Set<String> getOptionNames(Map<String, Set<TransformOption>> transformOptionsByName)
|
||||
{
|
||||
Set<String> set = new TreeSet<>();
|
||||
transformOptionsByName.forEach(((optionName, optionSet) ->
|
||||
optionSet.stream().forEach(option -> addOption(set, option))));
|
||||
transformOptionsByName.forEach(((optionName, optionSet) -> optionSet.stream().forEach(option -> addOption(set, option))));
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,9 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.logging;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import static java.lang.Math.max;
|
||||
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
@@ -38,14 +37,13 @@ import java.util.Deque;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.lang.Math.max;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
/**
|
||||
* Provides setter and getter methods to allow the current Thread to set various log properties and for these
|
||||
* values to be retrieved. The {@link #complete()} method should be called at the end of a request to flush the
|
||||
* current entry to an internal log Collection of the latest entries. The {@link #getLog()} method is used to obtain
|
||||
* access to this collection.
|
||||
* Provides setter and getter methods to allow the current Thread to set various log properties and for these values to be retrieved. The {@link #complete()} method should be called at the end of a request to flush the current entry to an internal log Collection of the latest entries. The {@link #getLog()} method is used to obtain access to this collection.
|
||||
*/
|
||||
public final class LogEntry
|
||||
{
|
||||
@@ -200,7 +198,8 @@ public final class LogEntry
|
||||
" (" +
|
||||
(time(durationStreamIn) + ' ' +
|
||||
time(durationTransform) + ' ' +
|
||||
time(durationStreamOut)).trim() +
|
||||
time(durationStreamOut)).trim()
|
||||
+
|
||||
")";
|
||||
}
|
||||
|
||||
@@ -236,14 +235,16 @@ public final class LogEntry
|
||||
|
||||
private String time(long ms)
|
||||
{
|
||||
return ms == -1 ? "" : size(ms, "1ms",
|
||||
return ms == -1 ? ""
|
||||
: size(ms, "1ms",
|
||||
new String[]{"ms", "s", "min", "hr"},
|
||||
new long[]{1000, 60 * 1000, 60 * 60 * 1000, Long.MAX_VALUE});
|
||||
}
|
||||
|
||||
private String size(long size)
|
||||
{
|
||||
return size == -1 ? "" : size(size, "1 byte",
|
||||
return size == -1 ? ""
|
||||
: size(size, "1 byte",
|
||||
new String[]{"bytes", " KB", " MB", " GB", " TB"},
|
||||
new long[]{1024, 1024 * 1024, 1024 * 1024 * 1024, 1024L * 1024 * 1024 * 1024, Long.MAX_VALUE});
|
||||
}
|
||||
|
||||
+3
-6
@@ -29,16 +29,13 @@ package org.alfresco.transform.base.logging;
|
||||
public final class StandardMessages
|
||||
{
|
||||
private StandardMessages()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
public static String COMMUNITY_LICENCE =
|
||||
"If the Alfresco software was purchased under a paid Alfresco license, the terms of the paid license agreement \n" +
|
||||
public static String COMMUNITY_LICENCE = "If the Alfresco software was purchased under a paid Alfresco license, the terms of the paid license agreement \n" +
|
||||
"will prevail. Otherwise, the software is provided under terms of the GNU LGPL v3 license. \n" +
|
||||
"See the license at http://www.gnu.org/licenses/lgpl-3.0.txt. or in /LICENSE.txt \n\n";
|
||||
|
||||
public static String ENTERPRISE_LICENCE =
|
||||
"This image is only intended to be used with the Alfresco Enterprise Content Repository which is covered by\n" +
|
||||
public static String ENTERPRISE_LICENCE = "This image is only intended to be used with the Alfresco Enterprise Content Repository which is covered by\n" +
|
||||
"https://www.alfresco.com/legal/agreements and https://www.alfresco.com/terms-use\n" +
|
||||
"\n" +
|
||||
"License rights for this program may be obtained from Alfresco Software, Ltd. pursuant to a written agreement\n" +
|
||||
|
||||
+6
-9
@@ -26,7 +26,9 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.messaging;
|
||||
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Queue;
|
||||
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@@ -40,15 +42,12 @@ import org.springframework.lang.NonNull;
|
||||
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import jakarta.jms.Queue;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
|
||||
/**
|
||||
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the
|
||||
* T-Engine able to read from queues and send a reply back.
|
||||
* JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the T-Engine able to read from queues and send a reply back.
|
||||
*
|
||||
* @author Lucian Tuca
|
||||
* created on 18/12/2018
|
||||
* @author Lucian Tuca created on 18/12/2018
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(name = "activemq.url")
|
||||
@@ -97,5 +96,3 @@ public class MessagingConfig implements JmsListenerConfigurer
|
||||
return new ActiveMQQueue(engineRequestQueueValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+20
-26
@@ -26,10 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.messaging;
|
||||
|
||||
import org.alfresco.transform.base.TransformController;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.util.Optional;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -39,22 +43,15 @@ import org.springframework.jms.annotation.JmsListener;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import org.alfresco.transform.base.TransformController;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Queue Transformer service.
|
||||
* This service reads all the requests for the particular engine, forwards them to the worker
|
||||
* component (at this time the injected controller - to be refactored) and sends back the reply
|
||||
* to the {@link Message#getJMSReplyTo()} value. If this value is missing we've got to a dead end.
|
||||
* Queue Transformer service. This service reads all the requests for the particular engine, forwards them to the worker component (at this time the injected controller - to be refactored) and sends back the reply to the {@link Message#getJMSReplyTo()} value. If this value is missing we've got to a dead end.
|
||||
*
|
||||
* @author Lucian Tuca
|
||||
* created on 18/12/2018
|
||||
* @author Lucian Tuca created on 18/12/2018
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnProperty(name = "activemq.url")
|
||||
@@ -127,10 +124,10 @@ public class QueueTransformService
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to convert the JMS {@link Message} to a {@link TransformRequest}
|
||||
* If any error occurs, a {@link TransformException} is thrown
|
||||
* Tries to convert the JMS {@link Message} to a {@link TransformRequest} If any error occurs, a {@link TransformException} is thrown
|
||||
*
|
||||
* @param msg Message to be deserialized
|
||||
* @param msg
|
||||
* Message to be deserialized
|
||||
* @return The converted {@link TransformRequest} instance
|
||||
*/
|
||||
private Optional<TransformRequest> convert(final Message msg, String correlationId)
|
||||
@@ -142,22 +139,19 @@ public class QueueTransformService
|
||||
}
|
||||
catch (MessageConversionException e)
|
||||
{
|
||||
String message =
|
||||
"MessageConversionException during T-Request deserialization of message with correlationID "
|
||||
String message = "MessageConversionException during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(BAD_REQUEST, message + e.getMessage());
|
||||
}
|
||||
catch (JMSException e)
|
||||
{
|
||||
String message =
|
||||
"JMSException during T-Request deserialization of message with correlationID "
|
||||
String message = "JMSException during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR, message + e.getMessage());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
String message =
|
||||
"Exception during T-Request deserialization of message with correlationID "
|
||||
String message = "Exception during T-Request deserialization of message with correlationID "
|
||||
+ correlationId + ": ";
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR, message + e.getMessage());
|
||||
}
|
||||
|
||||
+13
-19
@@ -27,11 +27,13 @@
|
||||
|
||||
package org.alfresco.transform.base.messaging;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.springframework.jms.support.converter.MappingJackson2MessageConverter;
|
||||
import org.springframework.jms.support.converter.MessageConversionException;
|
||||
import org.springframework.jms.support.converter.MessageConverter;
|
||||
@@ -39,13 +41,11 @@ import org.springframework.jms.support.converter.MessageType;
|
||||
import org.springframework.lang.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.jms.JMSException;
|
||||
import jakarta.jms.Message;
|
||||
import jakarta.jms.Session;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
/**
|
||||
* Copied from the t-router. We would need to create a common dependency between t-engine base and t-router that
|
||||
* knows about jms to remove this duplication.
|
||||
* Copied from the t-router. We would need to create a common dependency between t-engine base and t-router that knows about jms to remove this duplication.
|
||||
*
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
@@ -53,16 +53,13 @@ import jakarta.jms.Session;
|
||||
public class TransformMessageConverter implements MessageConverter
|
||||
{
|
||||
private static final MappingJackson2MessageConverter converter;
|
||||
private static final JavaType TRANSFORM_REQUEST_TYPE =
|
||||
TypeFactory.defaultInstance().constructType(TransformRequest.class);
|
||||
private static final JavaType TRANSFORM_REQUEST_TYPE = TypeFactory.defaultInstance().constructType(TransformRequest.class);
|
||||
|
||||
static
|
||||
{
|
||||
converter = new MappingJackson2MessageConverter()
|
||||
{
|
||||
converter = new MappingJackson2MessageConverter() {
|
||||
@Override
|
||||
@NonNull
|
||||
protected JavaType getJavaTypeForMessage(final Message message) throws JMSException
|
||||
@NonNull protected JavaType getJavaTypeForMessage(final Message message) throws JMSException
|
||||
{
|
||||
if (message.getStringProperty("_type") == null)
|
||||
{
|
||||
@@ -75,13 +72,11 @@ public class TransformMessageConverter implements MessageConverter
|
||||
converter.setTypeIdPropertyName("_type");
|
||||
converter.setTypeIdMappings(ImmutableMap.of(
|
||||
TransformRequest.class.getName(), TransformRequest.class,
|
||||
TransformReply.class.getName(), TransformReply.class)
|
||||
);
|
||||
TransformReply.class.getName(), TransformReply.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Message toMessage(
|
||||
@NonNull public Message toMessage(
|
||||
@NonNull final Object object,
|
||||
@NonNull final Session session) throws JMSException, MessageConversionException
|
||||
{
|
||||
@@ -89,8 +84,7 @@ public class TransformMessageConverter implements MessageConverter
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public Object fromMessage(@NonNull final Message message) throws JMSException
|
||||
@NonNull public Object fromMessage(@NonNull final Message message) throws JMSException
|
||||
{
|
||||
return converter.fromMessage(message);
|
||||
}
|
||||
|
||||
+2
-1
@@ -28,13 +28,14 @@ package org.alfresco.transform.base.messaging;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
|
||||
/**
|
||||
* Copied from the t-router.
|
||||
*
|
||||
|
||||
+38
-53
@@ -26,12 +26,7 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.metadata;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.slf4j.Logger;
|
||||
import static org.alfresco.transform.base.metadata.AbstractMetadataExtractorEmbedder.Type.EMBEDDER;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -50,45 +45,38 @@ import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static org.alfresco.transform.base.metadata.AbstractMetadataExtractorEmbedder.Type.EMBEDDER;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
/**
|
||||
* Helper methods for metadata extract and embed.
|
||||
* <p>
|
||||
* <i>Much of the code is based on AbstractMappingMetadataExtracter from the
|
||||
* content repository. The code has been simplified to only set up mapping one way.</i>
|
||||
* <i>Much of the code is based on AbstractMappingMetadataExtracter from the content repository. The code has been simplified to only set up mapping one way.</i>
|
||||
* <p>
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-extract"}
|
||||
* (specified in the {@code engine_config.json}), it is indicating that it can extract metadata from {@code <MIMETYPE>}.
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-extract"} (specified in the {@code engine_config.json}), it is indicating that it can extract metadata from {@code <MIMETYPE>}.
|
||||
*
|
||||
* The transform results in a Map of extracted properties encoded as json being returned to the content repository.
|
||||
* <ul>
|
||||
* <li>The method extracts ALL available metadata from the document with
|
||||
* {@link #extractMetadata(String, InputStream, String, OutputStream, Map, TransformManager)} and then calls
|
||||
* {@link #mapMetadataAndWrite(OutputStream, Map, Map)}.</li>
|
||||
* <li>Selected values from the available metadata are mapped into content repository property names and values,
|
||||
* depending on what is defined in a {@code "<classname>_metadata_extract.properties"} file.</li>
|
||||
* <li>The selected values are set back to the content repository as a JSON representation of a Map, where the values
|
||||
* are applied to the source node.</li>
|
||||
* <li>The method extracts ALL available metadata from the document with {@link #extractMetadata(String, InputStream, String, OutputStream, Map, TransformManager)} and then calls {@link #mapMetadataAndWrite(OutputStream, Map, Map)}.</li>
|
||||
* <li>Selected values from the available metadata are mapped into content repository property names and values, depending on what is defined in a {@code "<classname>_metadata_extract.properties"} file.</li>
|
||||
* <li>The selected values are set back to the content repository as a JSON representation of a Map, where the values are applied to the source node.</li>
|
||||
* </ul>
|
||||
* To support the same functionality as metadata extractors configured inside the content repository,
|
||||
* extra key value pairs may be returned from {@link #extractMetadata(String, InputStream, String, OutputStream, Map, TransformManager)}.
|
||||
* These are:
|
||||
* To support the same functionality as metadata extractors configured inside the content repository, extra key value pairs may be returned from {@link #extractMetadata(String, InputStream, String, OutputStream, Map, TransformManager)}. These are:
|
||||
* <ul>
|
||||
* <li>{@code "sys:overwritePolicy"} which can specify the
|
||||
* {@code org.alfresco.repo.content.metadata.MetadataExtracter.OverwritePolicy} name. Defaults to "PRAGMATIC".</li>
|
||||
* <li>{@code "sys:enableStringTagging"} if {@code "true"} finds or creates tags for each string mapped to
|
||||
* {@code cm:taggable}. Defaults to {@code "false"} to ignore mapping strings to tags.</li>
|
||||
* <li>{@code "sys:overwritePolicy"} which can specify the {@code org.alfresco.repo.content.metadata.MetadataExtracter.OverwritePolicy} name. Defaults to "PRAGMATIC".</li>
|
||||
* <li>{@code "sys:enableStringTagging"} if {@code "true"} finds or creates tags for each string mapped to {@code cm:taggable}. Defaults to {@code "false"} to ignore mapping strings to tags.</li>
|
||||
* <li>{@code "sys:carryAspectProperties"}</li>
|
||||
* <li>{@code "sys:stringTaggingSeparators"}</li>
|
||||
* </ul>
|
||||
*
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-embed"}, it is
|
||||
* indicating that it can embed metadata in {@code <MIMETYPE>}.
|
||||
* If a transform specifies that it can convert from {@code "<MIMETYPE>"} to {@code "alfresco-metadata-embed"}, it is indicating that it can embed metadata in {@code <MIMETYPE>}.
|
||||
*
|
||||
* The transform calls {@link #embedMetadata(String, InputStream, String, OutputStream, Map, TransformManager)}
|
||||
* which should results in a new version of supplied source file that contains the metadata supplied in the transform
|
||||
* options.
|
||||
* The transform calls {@link #embedMetadata(String, InputStream, String, OutputStream, Map, TransformManager)} which should results in a new version of supplied source file that contains the metadata supplied in the transform options.
|
||||
*
|
||||
* @author Jesper Steen Møller
|
||||
* @author Derek Hulley
|
||||
@@ -213,7 +201,8 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
logger.debug(
|
||||
"Converted system model values to metadata values: \n" +
|
||||
" System Properties: {}\n" +
|
||||
" Metadata Properties: {}", systemMetadata, metadataProperties);
|
||||
" Metadata Properties: {}",
|
||||
systemMetadata, metadataProperties);
|
||||
}
|
||||
return metadataProperties;
|
||||
}
|
||||
@@ -226,9 +215,8 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#getDefaultMapping.
|
||||
*
|
||||
* This method provides a <i>mapping</i> of where to store the values extracted from the documents. The list of
|
||||
* properties need <b>not</b> include all metadata values extracted from the document. This mapping should be
|
||||
* defined in a file based on the class name: {@code "<classname>_metadata_extract.properties"}
|
||||
* This method provides a <i>mapping</i> of where to store the values extracted from the documents. The list of properties need <b>not</b> include all metadata values extracted from the document. This mapping should be defined in a file based on the class name: {@code "<classname>_metadata_extract.properties"}
|
||||
*
|
||||
* @return Returns a static mapping. It may not be null.
|
||||
*/
|
||||
private Map<String, Set<String>> buildExtractMapping()
|
||||
@@ -278,13 +266,10 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#getDefaultEmbedMapping.
|
||||
*
|
||||
* This method provides a <i>mapping</i> of model properties that should be embedded in the content. The list of
|
||||
* properties need <b>not</b> include all properties. This mapping should be defined in a file based on the class
|
||||
* name: {@code "<classname>_metadata_embed.properties"}
|
||||
* This method provides a <i>mapping</i> of model properties that should be embedded in the content. The list of properties need <b>not</b> include all properties. This mapping should be defined in a file based on the class name: {@code "<classname>_metadata_embed.properties"}
|
||||
* <p>
|
||||
* If no {@code "<classname>_metadata_embed.properties"} file is found, a reverse of the
|
||||
* {@code "<classname>_metadata_extract.properties"} will be assumed. A last win approach will be used for handling
|
||||
* duplicates.
|
||||
* If no {@code "<classname>_metadata_embed.properties"} file is found, a reverse of the {@code "<classname>_metadata_extract.properties"} will be assumed. A last win approach will be used for handling duplicates.
|
||||
*
|
||||
* @return Returns a static mapping. It may not be null.
|
||||
*/
|
||||
private Map<String, Set<String>> buildEmbedMapping()
|
||||
@@ -388,8 +373,7 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
}
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@@ -437,14 +421,14 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
* <li>it is an empty collection</li>
|
||||
* <li>it is an empty array</li>
|
||||
* </ul>
|
||||
* String values are trimmed before being put into the map.
|
||||
* Otherwise, it is up to the extracter to ensure that the value is a <tt>Serializable</tt>.
|
||||
* It is not appropriate to implicitly convert values in order to make them <tt>Serializable</tt>
|
||||
* - the best conversion method will depend on the value's specific meaning.
|
||||
* String values are trimmed before being put into the map. Otherwise, it is up to the extracter to ensure that the value is a <tt>Serializable</tt>. It is not appropriate to implicitly convert values in order to make them <tt>Serializable</tt> - the best conversion method will depend on the value's specific meaning.
|
||||
*
|
||||
* @param key the destination key
|
||||
* @param value the serializable value
|
||||
* @param destination the map to put values into
|
||||
* @param key
|
||||
* the destination key
|
||||
* @param value
|
||||
* the serializable value
|
||||
* @param destination
|
||||
* the map to put values into
|
||||
* @return Returns <tt>true</tt> if set, otherwise <tt>false</tt>
|
||||
*/
|
||||
// Copied from the content repository's AbstractMappingMetadataExtracter.
|
||||
@@ -514,8 +498,7 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
String targetMimetype, OutputStream outputStream, Map<String, String> transformOptions,
|
||||
TransformManager transformManager) throws Exception;
|
||||
|
||||
private Map<String, Set<String>> getExtractMappingFromOptions(Map<String, String> transformOptions, Map<String,
|
||||
Set<String>> defaultExtractMapping)
|
||||
private Map<String, Set<String>> getExtractMappingFromOptions(Map<String, String> transformOptions, Map<String, Set<String>> defaultExtractMapping)
|
||||
{
|
||||
String extractMappingOption = transformOptions.get(EXTRACT_MAPPING);
|
||||
if (extractMappingOption != null)
|
||||
@@ -549,8 +532,10 @@ public abstract class AbstractMetadataExtractorEmbedder implements CustomTransfo
|
||||
/**
|
||||
* Based on AbstractMappingMetadataExtracter#mapRawToSystem.
|
||||
*
|
||||
* @param rawMetadata Metadata keyed by document properties
|
||||
* @param extractMapping Mapping between document ans system properties
|
||||
* @param rawMetadata
|
||||
* Metadata keyed by document properties
|
||||
* @param extractMapping
|
||||
* Mapping between document ans system properties
|
||||
* @return Returns the metadata keyed by the system properties
|
||||
*/
|
||||
private Map<String, Serializable> mapRawToSystem(Map<String, Serializable> rawMetadata,
|
||||
|
||||
@@ -37,7 +37,8 @@ public class FileRefEntity
|
||||
{
|
||||
private String fileRef;
|
||||
|
||||
public FileRefEntity() {}
|
||||
public FileRefEntity()
|
||||
{}
|
||||
|
||||
public FileRefEntity(String fileRef)
|
||||
{
|
||||
@@ -57,8 +58,10 @@ public class FileRefEntity
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
FileRefEntity that = (FileRefEntity) o;
|
||||
return Objects.equals(fileRef, that.fileRef);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,8 @@ public class FileRefResponse
|
||||
{
|
||||
private FileRefEntity entry;
|
||||
|
||||
public FileRefResponse() {}
|
||||
public FileRefResponse()
|
||||
{}
|
||||
|
||||
public FileRefResponse(FileRefEntity entry)
|
||||
{
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.probes;
|
||||
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import static org.springframework.http.HttpStatus.INSUFFICIENT_STORAGE;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS;
|
||||
|
||||
import static org.alfresco.transform.base.fs.FileManager.TempFileProvider.createTempFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -42,35 +42,33 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static org.alfresco.transform.base.fs.FileManager.TempFileProvider.createTempFile;
|
||||
import static org.springframework.http.HttpStatus.INSUFFICIENT_STORAGE;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Provides test transformations and the logic used by k8 liveness and readiness probes.
|
||||
*
|
||||
* <p><b>K8s probes</b>: A readiness probe indicates if the pod should accept request. <b>It does not indicate that a
|
||||
* pod is ready after startup</b>. The liveness probe indicates when to kill the pod. <b>Both probes are called
|
||||
* throughout the lifetime of the pod</b> and a <b>liveness probes can take place before a readiness probe.</b> The k8s
|
||||
* <b>initialDelaySeconds field is not fully honoured</b> as it is multiplied by a random number, so is
|
||||
* actually a maximum initial delay in seconds, but could be 0. </p>
|
||||
* <p>
|
||||
* <b>K8s probes</b>: A readiness probe indicates if the pod should accept request. <b>It does not indicate that a pod is ready after startup</b>. The liveness probe indicates when to kill the pod. <b>Both probes are called throughout the lifetime of the pod</b> and a <b>liveness probes can take place before a readiness probe.</b> The k8s <b>initialDelaySeconds field is not fully honoured</b> as it is multiplied by a random number, so is actually a maximum initial delay in seconds, but could be 0.
|
||||
* </p>
|
||||
*
|
||||
* <p>Live and readiness probes do test transforms. The first 6 requests result in a transformation of a small test
|
||||
* file. The average time and size is remembered, but excludes the first one as it is normally slower. This is
|
||||
* used in future requests to discover if transformations are becoming slower or unexpectedly change size.</p>
|
||||
* <p>
|
||||
* Live and readiness probes do test transforms. The first 6 requests result in a transformation of a small test file. The average time and size is remembered, but excludes the first one as it is normally slower. This is used in future requests to discover if transformations are becoming slower or unexpectedly change size.
|
||||
* </p>
|
||||
*
|
||||
* <p>If a transform longer than a maximum time, a maximum number of transforms have been performed, a test transform is
|
||||
* an unexpected size or a test transform takes an unexpected time, then a non 200 status code is returned resulting in
|
||||
* k8s terminating the pod. These are controlled by:</p>
|
||||
* <p>
|
||||
* If a transform longer than a maximum time, a maximum number of transforms have been performed, a test transform is an unexpected size or a test transform takes an unexpected time, then a non 200 status code is returned resulting in k8s terminating the pod. These are controlled by:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>expectedLength the expected length of the target file after a test transform</li>
|
||||
* <li>plusOrMinus allows for variation in the transformed size - generally caused by dates</li>
|
||||
* <li>livenessPercent allows for variation in transform time. Up to 2 and a half times is not
|
||||
* unreasonable under load</li>
|
||||
* <li>livenessPercent allows for variation in transform time. Up to 2 and a half times is not unreasonable under load</li>
|
||||
* <li>maxTransforms the maximum number of transforms (not just test ones) before a restart is triggered</li>
|
||||
* <li>maxTransformSeconds a maximum time any transform (not just test ones) is allowed to take before
|
||||
* a restart is triggered.</li>
|
||||
* <li>maxTransformSeconds a maximum time any transform (not just test ones) is allowed to take before a restart is triggered.</li>
|
||||
* <li>livenessTransformPeriodSeconds The number of seconds between test transforms done for live probes</li>
|
||||
* </ul>
|
||||
*/
|
||||
@@ -139,8 +137,7 @@ public class ProbeTransform
|
||||
return Boolean.parseBoolean(System.getenv(name));
|
||||
}
|
||||
catch (Exception ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@@ -155,8 +152,7 @@ public class ProbeTransform
|
||||
l = Long.parseLong(env);
|
||||
}
|
||||
catch (NumberFormatException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
if (l <= 0)
|
||||
{
|
||||
@@ -211,8 +207,7 @@ public class ProbeTransform
|
||||
do
|
||||
{
|
||||
nextTransformTime += livenessTransformPeriod;
|
||||
}
|
||||
while (nextTransformTime < start);
|
||||
} while (nextTransformTime < start);
|
||||
}
|
||||
|
||||
File sourceFile = getSourceFile(isLiveProbe);
|
||||
|
||||
+9
-9
@@ -26,18 +26,19 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
|
||||
@Component
|
||||
public class CustomTransformers
|
||||
@@ -54,8 +55,7 @@ public class CustomTransformers
|
||||
{
|
||||
if (customTransformerList != null)
|
||||
{
|
||||
customTransformerList.forEach(customTransformer ->
|
||||
customTransformersByName.put(customTransformer.getTransformerName(), customTransformer));
|
||||
customTransformerList.forEach(customTransformer -> customTransformersByName.put(customTransformer.getTransformerName(), customTransformer));
|
||||
|
||||
List<String> nonNullTransformerNames = customTransformerList.stream()
|
||||
.map(CustomTransformer::getTransformerName)
|
||||
|
||||
+4
-4
@@ -26,14 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "transform.config")
|
||||
public class TransformConfigFiles
|
||||
|
||||
+8
-7
@@ -26,18 +26,18 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import static org.alfresco.transform.base.registry.TransformConfigFromFiles.retrieveResource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.alfresco.transform.base.registry.TransformConfigFromFiles.retrieveResource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
/**
|
||||
* Similar to {@link TransformConfigFiles} but uses the names historically used by the t-router.
|
||||
@@ -51,7 +51,8 @@ public class TransformConfigFilesHistoric
|
||||
private final Map<String, String> additional = new HashMap<>();
|
||||
|
||||
// Used by ConfigurationProperties annotation
|
||||
public Map<String, String> getAdditional() {
|
||||
public Map<String, String> getAdditional()
|
||||
{
|
||||
return additional;
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -26,8 +26,14 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.alfresco.transform.config.reader.TransformConfigResourceReader;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@@ -35,13 +41,8 @@ import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.reader.TransformConfigResourceReader;
|
||||
|
||||
/**
|
||||
* Makes {@link TransformConfig} from files on the classpath or externally available to the {@link TransformRegistry}.
|
||||
@@ -66,13 +67,12 @@ public class TransformConfigFromFiles
|
||||
final List<Resource> resources = new ArrayList<>();
|
||||
resources.addAll(transformConfigFiles.retrieveResources());
|
||||
resources.addAll(transformConfigFilesHistoric.retrieveResources());
|
||||
resources.forEach(resource ->
|
||||
{
|
||||
resources.forEach(resource -> {
|
||||
String filename = resource.getFilename();
|
||||
transformConfigSources.add(
|
||||
new AbstractTransformConfigSource(filename, filename, isTRouter ? null : "---")
|
||||
{
|
||||
@Override public TransformConfig getTransformConfig()
|
||||
new AbstractTransformConfigSource(filename, filename, isTRouter ? null : "---") {
|
||||
@Override
|
||||
public TransformConfig getTransformConfig()
|
||||
{
|
||||
return transformConfigResourceReader.read(resource);
|
||||
}
|
||||
|
||||
+8
-7
@@ -26,14 +26,15 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.alfresco.transform.base.TransformEngine;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import java.util.List;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
import org.alfresco.transform.base.TransformEngine;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
|
||||
/**
|
||||
* Makes {@link TransformConfig} from {@link TransformEngine}s available to the {@link TransformRegistry}.
|
||||
@@ -60,9 +61,9 @@ public class TransformConfigFromTransformEngines
|
||||
{
|
||||
String engineName = transformEngine.getTransformEngineName();
|
||||
transformConfigSources.add(
|
||||
new AbstractTransformConfigSource(engineName, engineName, isTRouter ? null : "---")
|
||||
{
|
||||
@Override public TransformConfig getTransformConfig()
|
||||
new AbstractTransformConfigSource(engineName, engineName, isTRouter ? null : "---") {
|
||||
@Override
|
||||
public TransformConfig getTransformConfig()
|
||||
{
|
||||
return transformEngine.getTransformConfig();
|
||||
}
|
||||
|
||||
+39
-45
@@ -25,17 +25,26 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.registry;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.registry.CombinedTransformConfig;
|
||||
import org.alfresco.transform.registry.Origin;
|
||||
import org.alfresco.transform.registry.TransformCache;
|
||||
import org.alfresco.transform.registry.TransformerType;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Objects.isNull;
|
||||
import static java.util.stream.Collectors.toUnmodifiableMap;
|
||||
import static java.util.stream.Collectors.toUnmodifiableSet;
|
||||
|
||||
import static org.springframework.util.CollectionUtils.isEmpty;
|
||||
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
|
||||
import static org.alfresco.transform.registry.TransformerType.FAILOVER_TRANSFORMER;
|
||||
import static org.alfresco.transform.registry.TransformerType.PIPELINE_TRANSFORMER;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -49,23 +58,17 @@ import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Objects.isNull;
|
||||
import static java.util.stream.Collectors.toUnmodifiableMap;
|
||||
import static java.util.stream.Collectors.toUnmodifiableSet;
|
||||
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
|
||||
import static org.alfresco.transform.registry.TransformerType.FAILOVER_TRANSFORMER;
|
||||
import static org.alfresco.transform.registry.TransformerType.PIPELINE_TRANSFORMER;
|
||||
import static org.springframework.util.CollectionUtils.isEmpty;
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.TransformOption;
|
||||
import org.alfresco.transform.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.registry.CombinedTransformConfig;
|
||||
import org.alfresco.transform.registry.Origin;
|
||||
import org.alfresco.transform.registry.TransformCache;
|
||||
import org.alfresco.transform.registry.TransformerType;
|
||||
|
||||
@Service
|
||||
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
@@ -143,8 +146,7 @@ public class TransformRegistry extends AbstractTransformRegistry
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the registry on application startup. This allows Components in projects that extend the t-engine base
|
||||
* to use @PostConstruct to add to {@code transformConfigSources}, before the registry is loaded.
|
||||
* Load the registry on application startup. This allows Components in projects that extend the t-engine base to use @PostConstruct to add to {@code transformConfigSources}, before the registry is loaded.
|
||||
*/
|
||||
@Async
|
||||
void initRegistryOnAppStartup(final ContextRefreshedEvent event)
|
||||
@@ -191,8 +193,7 @@ public class TransformRegistry extends AbstractTransformRegistry
|
||||
TransformConfig transformConfig = source.getTransformConfig();
|
||||
availableTransformers.put(
|
||||
sortOnName,
|
||||
new LocalTransformConfigSource(transformConfig, sortOnName, source.getReadFrom(), source.getBaseUrl())
|
||||
);
|
||||
new LocalTransformConfigSource(transformConfig, sortOnName, source.getReadFrom(), source.getBaseUrl()));
|
||||
}
|
||||
catch (IllegalStateException e)
|
||||
{
|
||||
@@ -204,8 +205,7 @@ public class TransformRegistry extends AbstractTransformRegistry
|
||||
{
|
||||
logger.warn(
|
||||
"Failed to retrieved TransformConfig during refreshment. Stops refreshing TransformRegistry. {}",
|
||||
e.getMessage()
|
||||
);
|
||||
e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -374,8 +374,7 @@ public class TransformRegistry extends AbstractTransformRegistry
|
||||
public Transformer getTransformer(final String sourceMediaType, final Long fileSizeBytes,
|
||||
final String targetMediaType, final Map<String, String> transformOptions)
|
||||
{
|
||||
return concurrentRead(() ->
|
||||
{
|
||||
return concurrentRead(() -> {
|
||||
long fileSize = fileSizeBytes == null ? 0 : fileSizeBytes;
|
||||
String transformerName = findTransformerName(sourceMediaType, fileSize, targetMediaType, transformOptions, null);
|
||||
return getTransformer(transformerName);
|
||||
@@ -395,15 +394,10 @@ public class TransformRegistry extends AbstractTransformRegistry
|
||||
|
||||
public boolean checkSourceSize(String transformerName, String sourceMediaType, Long sourceSize, String targetMediaType)
|
||||
{
|
||||
return Optional.ofNullable(getTransformer(transformerName)).
|
||||
map(transformer -> transformer.getSupportedSourceAndTargetList().stream().
|
||||
filter(supported -> supported.getSourceMediaType().equals(sourceMediaType) &&
|
||||
supported.getTargetMediaType().equals(targetMediaType)).
|
||||
findFirst().
|
||||
map(supported -> supported.getMaxSourceSizeBytes() == -1 ||
|
||||
supported.getMaxSourceSizeBytes() >= sourceSize).
|
||||
orElse(false)).
|
||||
orElse(false);
|
||||
return Optional.ofNullable(getTransformer(transformerName)).map(transformer -> transformer.getSupportedSourceAndTargetList().stream().filter(supported -> supported.getSourceMediaType().equals(sourceMediaType) &&
|
||||
supported.getTargetMediaType().equals(targetMediaType)).findFirst().map(supported -> supported.getMaxSourceSizeBytes() == -1 ||
|
||||
supported.getMaxSourceSizeBytes() >= sourceSize)
|
||||
.orElse(false)).orElse(false);
|
||||
}
|
||||
|
||||
public String getEngineName(String transformerName)
|
||||
|
||||
+11
-8
@@ -33,10 +33,9 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
|
||||
import java.io.File;
|
||||
import javax.net.ssl.SSLException;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -54,8 +53,9 @@ import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import javax.net.ssl.SSLException;
|
||||
import org.alfresco.transform.base.WebClientBuilderAdjuster;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Simple Rest client that call Alfresco Shared File Store
|
||||
@@ -77,7 +77,8 @@ public class SharedFileStoreClient
|
||||
private WebClient client;
|
||||
|
||||
@PostConstruct
|
||||
public void init() throws SSLException {
|
||||
public void init() throws SSLException
|
||||
{
|
||||
final WebClient.Builder clientBuilder = WebClient.builder();
|
||||
adjuster.adjust(clientBuilder);
|
||||
client = clientBuilder.baseUrl(url.endsWith("/") ? url : url + "/")
|
||||
@@ -89,7 +90,8 @@ public class SharedFileStoreClient
|
||||
/**
|
||||
* Retrieves a file from Shared File Store using given file reference
|
||||
*
|
||||
* @param fileRef File reference
|
||||
* @param fileRef
|
||||
* File reference
|
||||
* @return ResponseEntity<Resource>
|
||||
*/
|
||||
public ResponseEntity<Resource> retrieveFile(String fileRef)
|
||||
@@ -108,7 +110,8 @@ public class SharedFileStoreClient
|
||||
/**
|
||||
* Stores given file in Shared File Store
|
||||
*
|
||||
* @param file File to be stored
|
||||
* @param file
|
||||
* File to be stored
|
||||
* @return A FileRefResponse containing detail about file's reference
|
||||
*/
|
||||
public FileRefResponse saveFile(File file)
|
||||
|
||||
+4
-6
@@ -26,12 +26,12 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.transform;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
/**
|
||||
* Separation of transform fragments logic from the {@link ProcessHandler} logic and {@link StreamHandler}.
|
||||
@@ -42,8 +42,7 @@ public abstract class FragmentHandler extends StreamHandler
|
||||
private boolean noMoreFragments;
|
||||
|
||||
protected void initTarget()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
public OutputStream respondWithFragment(Integer index, boolean finished) throws IOException
|
||||
{
|
||||
@@ -74,8 +73,7 @@ public abstract class FragmentHandler extends StreamHandler
|
||||
}
|
||||
|
||||
protected void logFragment(Integer index, Long outputLength)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
@Override
|
||||
protected void handleSuccessfulTransform() throws IOException
|
||||
|
||||
+7
-14
@@ -26,22 +26,17 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.transform;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
/**
|
||||
* Separation of InputStream, OutputStream, sourceFile and targetFile from the {@link ProcessHandler} logic. Allows
|
||||
* {@link CustomTransformer} implementations to call {@link TransformManager#createSourceFile()} and
|
||||
* {@link TransformManager#createTargetFile()} so that extra Files are not created if there was one already in
|
||||
* existence.
|
||||
* Separation of InputStream, OutputStream, sourceFile and targetFile from the {@link ProcessHandler} logic. Allows {@link CustomTransformer} implementations to call {@link TransformManager#createSourceFile()} and {@link TransformManager#createTargetFile()} so that extra Files are not created if there was one already in existence.
|
||||
*
|
||||
* Subclasses MUST call transformManager.setSourceFile(File) and transformManager.setSourceFile(File) if they start
|
||||
* with files rather than streams, before calling the {@link #init()} method which calls
|
||||
* transformManager.setOutputStream(InputStream) and transformManager.setOutputStream(OutputStream).
|
||||
* Subclasses MUST call transformManager.setSourceFile(File) and transformManager.setSourceFile(File) if they start with files rather than streams, before calling the {@link #init()} method which calls transformManager.setOutputStream(InputStream) and transformManager.setOutputStream(OutputStream).
|
||||
*/
|
||||
public abstract class StreamHandler
|
||||
{
|
||||
@@ -95,8 +90,7 @@ public abstract class StreamHandler
|
||||
}
|
||||
|
||||
protected void onSuccessfulTransform()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
protected void closeOutputStream() throws IOException
|
||||
{
|
||||
@@ -112,8 +106,7 @@ public abstract class StreamHandler
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+42
-42
@@ -26,34 +26,18 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.transform;
|
||||
|
||||
import org.alfresco.transform.base.sfs.SharedFileStoreClient;
|
||||
import org.alfresco.transform.base.messaging.TransformReplySender;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.registry.CustomTransformers;
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.common.ExtensionService;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.messages.TransformStack;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.DirectFieldBindingResult;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import static org.alfresco.transform.base.fs.FileManager.createAttachment;
|
||||
import static org.alfresco.transform.base.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transform.base.fs.FileManager.getDirectAccessUrlInputStream;
|
||||
import static org.alfresco.transform.base.fs.FileManager.getMultipartFileInputStream;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
@@ -66,16 +50,35 @@ import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import jakarta.jms.Destination;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static org.alfresco.transform.base.fs.FileManager.createAttachment;
|
||||
import static org.alfresco.transform.base.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transform.base.fs.FileManager.getDirectAccessUrlInputStream;
|
||||
import static org.alfresco.transform.base.fs.FileManager.getMultipartFileInputStream;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.DirectFieldBindingResult;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import org.alfresco.transform.base.messaging.TransformReplySender;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.registry.CustomTransformers;
|
||||
import org.alfresco.transform.base.sfs.SharedFileStoreClient;
|
||||
import org.alfresco.transform.client.model.InternalContext;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.common.ExtensionService;
|
||||
import org.alfresco.transform.common.TransformerDebug;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transform.messages.TransformRequestValidator;
|
||||
import org.alfresco.transform.messages.TransformStack;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
|
||||
/**
|
||||
* Handles the transform requests from either http or a message.
|
||||
@@ -110,8 +113,7 @@ public class TransformHandler
|
||||
|
||||
new ProcessHandler(sourceMimetype, targetMimetype, requestParameters,
|
||||
"e" + httpRequestCount.getAndIncrement(), transformRegistry,
|
||||
transformerDebug, probeTransform, customTransformers)
|
||||
{
|
||||
transformerDebug, probeTransform, customTransformers) {
|
||||
@Override
|
||||
protected void init() throws IOException
|
||||
{
|
||||
@@ -155,8 +157,7 @@ public class TransformHandler
|
||||
{
|
||||
new ProcessHandler(sourceMimetype, targetMimetype, transformOptions,
|
||||
"p" + httpRequestCount.getAndIncrement(), transformRegistry,
|
||||
transformerDebug, probeTransform, customTransformers)
|
||||
{
|
||||
transformerDebug, probeTransform, customTransformers) {
|
||||
@Override
|
||||
protected void init() throws IOException
|
||||
{
|
||||
@@ -192,8 +193,7 @@ public class TransformHandler
|
||||
TransformReply reply = createBasicTransformReply(request);
|
||||
new ProcessHandler(request.getSourceMediaType(), request.getTargetMediaType(),
|
||||
request.getTransformRequestOptions(), "unset", transformRegistry,
|
||||
transformerDebug, probeTransform, customTransformers)
|
||||
{
|
||||
transformerDebug, probeTransform, customTransformers) {
|
||||
@Override
|
||||
protected void init() throws IOException
|
||||
{
|
||||
|
||||
+4
-5
@@ -26,17 +26,16 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.util;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
/**
|
||||
* Helper interface for older code that uses Files rather than InputStreams and OutputStreams.
|
||||
* If you can, refactor your code to NOT use Files.
|
||||
* Helper interface for older code that uses Files rather than InputStreams and OutputStreams. If you can, refactor your code to NOT use Files.
|
||||
*/
|
||||
public interface CustomTransformerFileAdaptor extends CustomTransformer
|
||||
{
|
||||
|
||||
@@ -29,13 +29,13 @@ package org.alfresco.transform.base.util;
|
||||
public class Util
|
||||
{
|
||||
private Util()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* Safely converts a {@link String} to an {@link Integer}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Integer}
|
||||
*/
|
||||
public static Integer stringToInteger(final String param)
|
||||
@@ -46,7 +46,8 @@ public class Util
|
||||
/**
|
||||
* Safely converts a {@link String} to a {@link Boolean}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Boolean}
|
||||
*/
|
||||
public static Boolean stringToBoolean(final String param)
|
||||
@@ -57,7 +58,8 @@ public class Util
|
||||
/**
|
||||
* Safely converts a {@link String} to a {@link Long}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @param param
|
||||
* String to be converted
|
||||
* @return Null if param is null or converted value as {@link Boolean}
|
||||
*/
|
||||
public static Long stringToLong(final String param)
|
||||
|
||||
@@ -26,30 +26,22 @@
|
||||
*/
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.alfresco.transform.base.sfs.SharedFileStoreClient;
|
||||
import org.alfresco.transform.base.executors.CommandExecutor;
|
||||
import org.alfresco.transform.base.executors.RuntimeExec;
|
||||
import org.alfresco.transform.base.model.FileRefEntity;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.http.HttpHeaders.ACCEPT;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -64,20 +56,31 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
|
||||
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.http.HttpHeaders.ACCEPT;
|
||||
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.ResultActions;
|
||||
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import org.alfresco.transform.base.executors.CommandExecutor;
|
||||
import org.alfresco.transform.base.executors.RuntimeExec;
|
||||
import org.alfresco.transform.base.model.FileRefEntity;
|
||||
import org.alfresco.transform.base.model.FileRefResponse;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.base.sfs.SharedFileStoreClient;
|
||||
import org.alfresco.transform.base.transform.TransformHandler;
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.registry.TransformServiceRegistry;
|
||||
|
||||
/**
|
||||
* Super class for unit testing.
|
||||
@@ -123,8 +126,7 @@ public abstract class AbstractBaseTest
|
||||
/**
|
||||
* The expected result. Taken resting target quick file's bytes.
|
||||
*
|
||||
* Note: These checks generally don't work on Windows (Mac and Linux are okay). Possibly to do with byte order
|
||||
* loading.
|
||||
* Note: These checks generally don't work on Windows (Mac and Linux are okay). Possibly to do with byte order loading.
|
||||
*/
|
||||
protected byte[] expectedTargetFileBytes;
|
||||
|
||||
@@ -152,22 +154,22 @@ public abstract class AbstractBaseTest
|
||||
protected void mockTransformCommand(String sourceExtension,
|
||||
String targetExtension, String sourceMimetype,
|
||||
boolean readTargetFileBytes) throws IOException
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
protected void updateTransformRequestWithSpecificOptions(TransformRequest transformRequest)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* This method ends up being the core of the mock.
|
||||
* It copies content from an existing file in the resources folder to the desired location
|
||||
* in order to simulate a successful transformation.
|
||||
* This method ends up being the core of the mock. It copies content from an existing file in the resources folder to the desired location in order to simulate a successful transformation.
|
||||
*
|
||||
* @param actualTargetExtension Requested extension.
|
||||
* @param testFile The test file (transformed) - basically the result.
|
||||
* @param targetFile The location where the content from the testFile should be copied
|
||||
* @throws IOException in case of any errors.
|
||||
* @param actualTargetExtension
|
||||
* Requested extension.
|
||||
* @param testFile
|
||||
* The test file (transformed) - basically the result.
|
||||
* @param targetFile
|
||||
* The location where the content from the testFile should be copied
|
||||
* @throws IOException
|
||||
* in case of any errors.
|
||||
*/
|
||||
public void generateTargetFileFromResourceFile(String actualTargetExtension, File testFile,
|
||||
File targetFile) throws IOException
|
||||
@@ -185,7 +187,8 @@ public abstract class AbstractBaseTest
|
||||
FileChannel target = outputStream.getChannel();
|
||||
target.transferFrom(source, 0, source.size());
|
||||
|
||||
} catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
+12
-20
@@ -1,24 +1,19 @@
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import org.springframework.http.client.MultipartBodyBuilder;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.containers.wait.strategy.Wait;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.HttpStatus.TOO_MANY_REQUESTS;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.client.MultipartBodyBuilder;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.containers.wait.strategy.Wait;
|
||||
|
||||
public abstract class LivenessReadinessProbeTest
|
||||
{
|
||||
@@ -34,12 +29,9 @@ public abstract class LivenessReadinessProbeTest
|
||||
env.start();
|
||||
var url = "http://localhost:" + env.getFirstMappedPort();
|
||||
|
||||
/*
|
||||
Asserts that /ready probe hasn't died before sending a transformation request.
|
||||
Each /ready request creates a valid transformation and increases the counter of
|
||||
used transformations, hence the need to divide MAX_TRANSFORMS
|
||||
*/
|
||||
for (int i = 0; i<MAX_TRANSFORMS/2; i++) {
|
||||
/* Asserts that /ready probe hasn't died before sending a transformation request. Each /ready request creates a valid transformation and increases the counter of used transformations, hence the need to divide MAX_TRANSFORMS */
|
||||
for (int i = 0; i < MAX_TRANSFORMS / 2; i++)
|
||||
{
|
||||
assertProbeIsOk(url);
|
||||
sendTransformRequest(url, testData.sourceMimetype, testData.targetMimetype, testData.filename);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,18 @@
|
||||
*/
|
||||
package org.alfresco.transform.base;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
|
||||
@@ -42,19 +54,8 @@ import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.UnrecoverableKeyException;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
public class MtlsTestUtils {
|
||||
public class MtlsTestUtils
|
||||
{
|
||||
|
||||
private static final boolean MTLS_ENABLED = Boolean.parseBoolean(System.getProperty("test-mtls-enabled"));
|
||||
private static final boolean HOSTNAME_VERIFICATION_DISABLED = Boolean.parseBoolean(System.getProperty("test-client-disable-hostname-verification"));
|
||||
@@ -96,18 +97,18 @@ public class MtlsTestUtils {
|
||||
return HttpClients.custom().setConnectionManager(buildSslConnectionManager(sslContext)).build();
|
||||
}
|
||||
|
||||
private static HttpClientConnectionManager buildSslConnectionManager(SSLContext sslContext) {
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder =
|
||||
SSLConnectionSocketFactoryBuilder.create()
|
||||
private static HttpClientConnectionManager buildSslConnectionManager(SSLContext sslContext)
|
||||
{
|
||||
final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = SSLConnectionSocketFactoryBuilder.create()
|
||||
.setSslContext(sslContext)
|
||||
.setTlsVersions(TLS.V_1_2, TLS.V_1_3);
|
||||
if (HOSTNAME_VERIFICATION_DISABLED) {
|
||||
if (HOSTNAME_VERIFICATION_DISABLED)
|
||||
{
|
||||
sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE);
|
||||
}
|
||||
final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build();
|
||||
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry =
|
||||
RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
final Registry<ConnectionSocketFactory> sslSocketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
|
||||
.register("https", sslConnectionSocketFactory)
|
||||
.build();
|
||||
|
||||
@@ -117,9 +118,12 @@ public class MtlsTestUtils {
|
||||
public static RestTemplate restTemplateWithMtls()
|
||||
{
|
||||
ClientHttpRequestFactory requestFactory = null;
|
||||
try {
|
||||
try
|
||||
{
|
||||
requestFactory = new HttpComponentsClientHttpRequestFactory(httpClientWithMtls());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new RestTemplate(requestFactory);
|
||||
@@ -130,7 +134,8 @@ public class MtlsTestUtils {
|
||||
return MtlsTestUtils.isMtlsEnabled() ? MtlsTestUtils.restTemplateWithMtls() : new RestTemplate();
|
||||
}
|
||||
|
||||
public static CloseableHttpClient getHttpClient() throws UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, KeyManagementException {
|
||||
public static CloseableHttpClient getHttpClient() throws UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, KeyManagementException
|
||||
{
|
||||
return MtlsTestUtils.isMtlsEnabled() ? MtlsTestUtils.httpClientWithMtls() : HttpClients.createDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
package org.alfresco.transform.base.clients;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.base.MtlsTestUtils;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -23,6 +24,8 @@ import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import org.alfresco.transform.base.MtlsTestUtils;
|
||||
|
||||
/**
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
|
||||
@@ -18,17 +18,16 @@ import jakarta.jms.MessageProducer;
|
||||
import jakarta.jms.Session;
|
||||
import jakarta.jms.TextMessage;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.apache.activemq.ActiveMQConnection;
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.command.ActiveMQQueue;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
|
||||
/**
|
||||
* JMSClient
|
||||
*
|
||||
* Contains the bare minimum logic necessary for sending and receiving T-Request/Reply messages
|
||||
* through the basic vanilla ActiveMQ client.
|
||||
* Contains the bare minimum logic necessary for sending and receiving T-Request/Reply messages through the basic vanilla ActiveMQ client.
|
||||
*
|
||||
* Used by Aspose t-engine and t-router, but likely to be useful in other t-engines.
|
||||
*
|
||||
@@ -68,8 +67,7 @@ public class JmsClient
|
||||
sendBytesMessage(JacksonSerializer.serialize(request), correlationID, replyTo);
|
||||
}
|
||||
|
||||
public void sendBytesMessage(final byte[] data, final String correlationID) throws
|
||||
Exception
|
||||
public void sendBytesMessage(final byte[] data, final String correlationID) throws Exception
|
||||
{
|
||||
try (final Connection connection = factory.createConnection();
|
||||
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
@@ -120,8 +118,7 @@ public class JmsClient
|
||||
sendTextMessage(new String(JacksonSerializer.serialize(request)), correlationID);
|
||||
}
|
||||
|
||||
public void sendTextMessage(final String data, final String correlationID) throws
|
||||
Exception
|
||||
public void sendTextMessage(final String data, final String correlationID) throws Exception
|
||||
{
|
||||
try (final Connection connection = factory.createConnection();
|
||||
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
@@ -167,11 +164,9 @@ public class JmsClient
|
||||
try
|
||||
{
|
||||
while (receiveMessage(2 * 1000) != null)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
catch (Exception ignore)
|
||||
{
|
||||
}
|
||||
{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import org.alfresco.transform.base.MtlsTestUtils;
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpGet;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpHead;
|
||||
import org.apache.hc.client5.http.classic.methods.HttpPost;
|
||||
@@ -36,10 +38,7 @@ import org.apache.hc.core5.http.HttpResponse;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import org.alfresco.transform.base.MtlsTestUtils;
|
||||
|
||||
/**
|
||||
* Used by Aspose t-engine and t-router, but likely to be useful in other t-engines.
|
||||
|
||||
@@ -47,8 +47,10 @@ public class SourceTarget
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
SourceTarget that = (SourceTarget) o;
|
||||
return Objects.equals(source, that.source) &&
|
||||
Objects.equals(target, that.target);
|
||||
|
||||
+6
-3
@@ -26,9 +26,10 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import org.springframework.boot.test.context.TestComponent;
|
||||
|
||||
import org.alfresco.transform.base.TransformEngine;
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.springframework.boot.test.context.TestComponent;
|
||||
|
||||
/**
|
||||
* Subclass MUST be named FakeTransformEngineWith\<something> otherwise the engine name will be "undefined".
|
||||
@@ -39,7 +40,8 @@ public abstract class AbstractFakeTransformEngine implements TransformEngine
|
||||
|
||||
private static final String FAKE_TRANSFORM_ENGINE_WITH = "FakeTransformEngineWith";
|
||||
|
||||
@Override public String getTransformEngineName()
|
||||
@Override
|
||||
public String getTransformEngineName()
|
||||
{
|
||||
String simpleClassName = getClass().getSimpleName();
|
||||
return simpleClassName.startsWith(FAKE_TRANSFORM_ENGINE_WITH)
|
||||
@@ -47,7 +49,8 @@ public abstract class AbstractFakeTransformEngine implements TransformEngine
|
||||
: "undefined";
|
||||
}
|
||||
|
||||
@Override public String getStartupMessage()
|
||||
@Override
|
||||
public String getStartupMessage()
|
||||
{
|
||||
return "Startup " + getTransformEngineName() +
|
||||
"\nLine 2 " + getTransformEngineName() +
|
||||
|
||||
+8
-8
@@ -26,21 +26,21 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.test.context.TestComponent;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.test.context.TestComponent;
|
||||
|
||||
import org.alfresco.transform.base.CustomTransformer;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
|
||||
/**
|
||||
* Subclass MUST be named FakeTransformer\<something>. Appends the name of the CustomTransformer and any t-options
|
||||
* to the output. The output is always a String regardless of the stated mimetypes.
|
||||
* Subclass MUST be named FakeTransformer\<something>. Appends the name of the CustomTransformer and any t-options to the output. The output is always a String regardless of the stated mimetypes.
|
||||
*/
|
||||
@TestComponent
|
||||
public abstract class AbstractFakeTransformer implements CustomTransformer
|
||||
|
||||
+6
-3
@@ -26,22 +26,25 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class FakeTransformEngineWithAllInOne extends AbstractFakeTransformEngine
|
||||
{
|
||||
@Autowired
|
||||
private FakeTransformEngineWithTwoCustomTransformers oneOfTheTransformEngines;
|
||||
|
||||
@Override public TransformConfig getTransformConfig()
|
||||
@Override
|
||||
public TransformConfig getTransformConfig()
|
||||
{
|
||||
// Has no config of its own. The combined config of the others is returned from the t-engine.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public ProbeTransform getProbeTransform()
|
||||
@Override
|
||||
public ProbeTransform getProbeTransform()
|
||||
{
|
||||
return oneOfTheTransformEngines.getProbeTransform();
|
||||
}
|
||||
|
||||
+10
-7
@@ -26,21 +26,23 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
|
||||
public class FakeTransformEngineWithFragments extends AbstractFakeTransformEngine
|
||||
{
|
||||
@Override public TransformConfig getTransformConfig()
|
||||
@Override
|
||||
public TransformConfig getTransformConfig()
|
||||
{
|
||||
return TransformConfig.builder()
|
||||
.withTransformers(ImmutableList.of(
|
||||
@@ -55,7 +57,8 @@ public class FakeTransformEngineWithFragments extends AbstractFakeTransformEngi
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override public ProbeTransform getProbeTransform()
|
||||
@Override
|
||||
public ProbeTransform getProbeTransform()
|
||||
{
|
||||
return new ProbeTransform("probe.pdf", MIMETYPE_PDF, MIMETYPE_IMAGE_JPEG, Collections.emptyMap(),
|
||||
60, 16, 400, 10240, 60 * 30 + 1, 60 * 15 + 20);
|
||||
|
||||
+8
-5
@@ -26,21 +26,23 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
|
||||
public class FakeTransformEngineWithOneCustomTransformer extends AbstractFakeTransformEngine
|
||||
{
|
||||
@Override public TransformConfig getTransformConfig()
|
||||
@Override
|
||||
public TransformConfig getTransformConfig()
|
||||
{
|
||||
String imageOptions = "imageOptions";
|
||||
return TransformConfig.builder()
|
||||
@@ -61,7 +63,8 @@ public class FakeTransformEngineWithOneCustomTransformer extends AbstractFakeTra
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override public ProbeTransform getProbeTransform()
|
||||
@Override
|
||||
public ProbeTransform getProbeTransform()
|
||||
{
|
||||
return null; // Not used in tests
|
||||
}
|
||||
|
||||
+9
-8
@@ -26,9 +26,18 @@
|
||||
*/
|
||||
package org.alfresco.transform.base.fakes;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_PNG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.common.RequestParamMap.SOURCE_ENCODING;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import org.alfresco.transform.base.probes.ProbeTransform;
|
||||
import org.alfresco.transform.config.SupportedSourceAndTarget;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
@@ -36,14 +45,6 @@ import org.alfresco.transform.config.TransformOptionValue;
|
||||
import org.alfresco.transform.config.TransformStep;
|
||||
import org.alfresco.transform.config.Transformer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_PNG;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.common.RequestParamMap.SOURCE_ENCODING;
|
||||
|
||||
public class FakeTransformEngineWithTwoCustomTransformers extends AbstractFakeTransformEngine
|
||||
{
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user