mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-24 14:32:01 +00:00
Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
731d580f7e | ||
|
ad4126ffea | ||
|
933aced67c | ||
|
de0ba15a91 | ||
|
00c36251d4 | ||
|
ea9ce0c0c2 | ||
|
37231e50a2 | ||
|
26d8c7dcbe | ||
|
6ea97033d3 | ||
|
cd0b2ffd24 | ||
|
a14cbacb68 | ||
|
fc0b9863d4 | ||
|
29dc42d445 | ||
|
39da968d76 | ||
|
6a4fecd46e | ||
|
e083d4fcc2 | ||
|
53e8a06a6e | ||
|
c80e1fa94b | ||
|
675c6f7aa1 | ||
|
44d67847da | ||
|
d405043c5d | ||
|
da50f6271c | ||
|
a5e713c176 | ||
|
2dcd2788b2 | ||
|
6b738342c1 | ||
|
ba5f5418ab | ||
|
ee8f3bec18 | ||
|
39395af528 | ||
|
e6f9d88779 | ||
|
70f70c6ed3 | ||
|
15045f9612 | ||
|
c50c7c6a7e | ||
|
60199141f5 | ||
|
b5e023950d | ||
|
d4591acf2c | ||
|
f34f2849dd | ||
|
52f2be49f3 | ||
|
748be1f4a0 | ||
|
52f1af2da6 | ||
|
626a97ff45 | ||
|
4a91132226 | ||
|
b6fb8725ce | ||
|
5fc0d9edde | ||
|
44d394b1a0 | ||
|
c1d62cca4d | ||
|
24ae4ce57c | ||
|
b8f2ec252d | ||
|
ae721c86f6 | ||
|
aacef0c949 | ||
|
e4edceda75 | ||
|
09ec6688c6 | ||
|
14025f00de | ||
|
22c5a5e134 | ||
|
154cad1ff8 | ||
|
7749b89e2b | ||
|
bbb45e667b | ||
|
a5f01e0d94 | ||
|
0c6d455ec4 | ||
|
5e86f5163e | ||
|
4981be1564 | ||
|
9a30fbb75a | ||
|
9c86fdb8b5 | ||
|
c52f74832d | ||
|
70dd7642f4 |
184
.github/workflows/ci.yml
vendored
184
.github/workflows/ci.yml
vendored
@@ -44,14 +44,14 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- id: changed-files
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/github-list-changes@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/github-list-changes@v8.2.0
|
||||
with:
|
||||
write-list-to-env: true
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Prepare maven cache and check compilation"
|
||||
@@ -69,12 +69,12 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/veracode@v8.2.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
srcclr-api-token: ${{ secrets.SRCCLR_API_TOKEN }}
|
||||
@@ -92,10 +92,10 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/github-download-file@v8.2.0
|
||||
with:
|
||||
token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
repository: "Alfresco/veracode-baseline-archive"
|
||||
@@ -142,9 +142,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[skip tests]') &&
|
||||
!contains(github.event.head_commit.message, '[force]')
|
||||
steps:
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- uses: Alfresco/ya-pmd-scan@v4.1.0
|
||||
with:
|
||||
classpath-build-command: "mvn test-compile -ntp -Pags -pl \"-:alfresco-community-repo-docker\""
|
||||
@@ -175,14 +175,14 @@ jobs:
|
||||
testAttributes: "-Dtest=AllMmtUnitTestSuite"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testModule }}
|
||||
@@ -213,7 +213,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -255,9 +255,9 @@ jobs:
|
||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
@@ -270,7 +270,7 @@ jobs:
|
||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }}
|
||||
@@ -301,7 +301,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -334,9 +334,9 @@ jobs:
|
||||
version: ['10.2.18', '10.4', '10.5']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: Run MariaDB ${{ matrix.version }} database
|
||||
@@ -345,7 +345,7 @@ jobs:
|
||||
MARIADB_VERSION: ${{ matrix.version }}
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.version }}
|
||||
@@ -376,7 +376,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -405,9 +405,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run MariaDB 10.6 database"
|
||||
@@ -416,7 +416,7 @@ jobs:
|
||||
MARIADB_VERSION: 10.6
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -447,7 +447,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -476,9 +476,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run MySQL 8 database"
|
||||
@@ -487,7 +487,7 @@ jobs:
|
||||
MYSQL_VERSION: 8
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -518,7 +518,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -546,9 +546,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run PostgreSQL 13.12 database"
|
||||
@@ -557,7 +557,7 @@ jobs:
|
||||
POSTGRES_VERSION: 13.12
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -588,7 +588,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -616,9 +616,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run PostgreSQL 14.9 database"
|
||||
@@ -627,7 +627,7 @@ jobs:
|
||||
POSTGRES_VERSION: 14.9
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -658,7 +658,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -686,9 +686,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run PostgreSQL 15.4 database"
|
||||
@@ -697,7 +697,7 @@ jobs:
|
||||
POSTGRES_VERSION: 15.4
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -728,7 +728,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -754,16 +754,16 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run ActiveMQ"
|
||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile activemq up -d
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -794,7 +794,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -854,9 +854,9 @@ jobs:
|
||||
mvn-options: '-Dencryption.ssl.keystore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.keystore -Dencryption.ssl.truststore.location=${CI_WORKSPACE}/keystores/alfresco/alfresco.truststore'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Set transformers tag"
|
||||
@@ -879,7 +879,7 @@ jobs:
|
||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile ${{ matrix.compose-profile }} up -d
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.testSuite }} ${{ matrix.idp }}
|
||||
@@ -910,7 +910,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -968,9 +968,9 @@ jobs:
|
||||
REQUIRES_LOCAL_IMAGES: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
@@ -986,7 +986,7 @@ jobs:
|
||||
run: mvn install -pl :alfresco-community-repo-integration-test -am -DskipTests -Pall-tas-tests
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} - ${{ matrix.test-name }}
|
||||
@@ -1024,7 +1024,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.tests.outcome }}
|
||||
@@ -1050,16 +1050,16 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- name: "Run Postgres 15.4 database"
|
||||
run: docker compose -f ./scripts/ci/docker-compose/docker-compose.yaml --profile postgres up -d
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -1090,7 +1090,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -1124,9 +1124,9 @@ jobs:
|
||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
@@ -1134,7 +1134,7 @@ jobs:
|
||||
bash ./scripts/ci/build.sh
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (PostgreSQL) ${{ matrix.test-name }}
|
||||
@@ -1170,9 +1170,9 @@ jobs:
|
||||
REQUIRES_INSTALLED_ARTIFACTS: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
@@ -1180,7 +1180,7 @@ jobs:
|
||||
bash ./scripts/ci/build.sh
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }} 0${{ matrix.part }} - (MySQL) ${{ matrix.test-name }}
|
||||
@@ -1212,9 +1212,9 @@ jobs:
|
||||
REQUIRES_LOCAL_IMAGES: true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
@@ -1228,7 +1228,7 @@ jobs:
|
||||
mvn -B install -pl :alfresco-governance-services-automation-community-rest-api -am -Pags -Pall-tas-tests -DskipTests
|
||||
- name: "Prepare Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-prepare@v8.2.0
|
||||
id: rp-prepare
|
||||
with:
|
||||
rp-launch-prefix: ${{ env.RP_LAUNCH_PREFIX }}
|
||||
@@ -1260,7 +1260,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
- name: "Summarize Report Portal"
|
||||
if: github.ref_name == 'master'
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v7.1.0
|
||||
uses: Alfresco/alfresco-build-tools/.github/actions/reportportal-summarize@v8.2.0
|
||||
id: rp-summarize
|
||||
with:
|
||||
tests-outcome: ${{ steps.run-tests.outcome }}
|
||||
@@ -1302,9 +1302,9 @@ jobs:
|
||||
!contains(github.event.head_commit.message, '[force]')
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Build"
|
||||
timeout-minutes: ${{ fromJSON(env.GITHUB_ACTIONS_DEPLOY_TIMEOUT) }}
|
||||
run: |
|
||||
|
16
.github/workflows/master_release.yml
vendored
16
.github/workflows/master_release.yml
vendored
@@ -34,12 +34,12 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.2.0
|
||||
with:
|
||||
username: ${{ env.GIT_USERNAME }}
|
||||
email: ${{ env.GIT_EMAIL }}
|
||||
@@ -63,12 +63,12 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/get-build-info@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space@v8.2.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/setup-java-build@v8.2.0
|
||||
- name: "Init"
|
||||
run: bash ./scripts/ci/init.sh
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v7.1.0
|
||||
- uses: Alfresco/alfresco-build-tools/.github/actions/configure-git-author@v8.2.0
|
||||
with:
|
||||
username: ${{ env.GIT_USERNAME }}
|
||||
email: ${{ env.GIT_EMAIL }}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -3,8 +3,8 @@
|
||||
#
|
||||
|
||||
# Version label
|
||||
version.major=23
|
||||
version.minor=4
|
||||
version.major=25
|
||||
version.minor=1
|
||||
version.revision=0
|
||||
version.label=
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -118,6 +118,18 @@
|
||||
<groupId>org.jibx</groupId>
|
||||
<artifactId>jibx-run</artifactId>
|
||||
<version>1.4.2</version>
|
||||
<exclusions>
|
||||
<!-- [ACS-5371] Excluded to avoid conflict in JDK9+ as it includes javax.xml-->
|
||||
<exclusion>
|
||||
<groupId>xpp3</groupId>
|
||||
<artifactId>xpp3</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.kxml</groupId>
|
||||
<artifactId>kxml2</artifactId>
|
||||
<version>${dependency.kxml2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -146,6 +146,7 @@ libgif http://giflib.sourceforge.net/
|
||||
libfreetype http://www.freetype.org/
|
||||
PostgreSQL http://www.postgresql.org/
|
||||
PostgreSQL JDBC Driver http://www.postgresql.org/
|
||||
kXML 2 http://kxml.sourceforge.net/
|
||||
|
||||
|
||||
=== CDDL 1.0 ===
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<organization>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -171,7 +171,7 @@
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy</artifactId>
|
||||
<version>3.0.22</version>
|
||||
<version>3.0.23</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-json-->
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
35
pom.xml
35
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<acs.version.major>23</acs.version.major>
|
||||
<acs.version.minor>4</acs.version.minor>
|
||||
<acs.version.major>25</acs.version.major>
|
||||
<acs.version.minor>1</acs.version.minor>
|
||||
<acs.version.revision>0</acs.version.revision>
|
||||
<acs.version.label />
|
||||
<amp.min.version>${acs.version.major}.0.0</amp.min.version>
|
||||
@@ -64,38 +64,39 @@
|
||||
<dependency.cxf.version>4.0.5</dependency.cxf.version>
|
||||
<dependency.opencmis.version>1.0.0-jakarta-1</dependency.opencmis.version>
|
||||
<dependency.webscripts.version>9.4</dependency.webscripts.version>
|
||||
<dependency.bouncycastle.version>1.78.1</dependency.bouncycastle.version>
|
||||
<dependency.bouncycastle.version>1.79</dependency.bouncycastle.version>
|
||||
<dependency.mockito-core.version>5.14.1</dependency.mockito-core.version>
|
||||
<dependency.assertj.version>3.26.3</dependency.assertj.version>
|
||||
<dependency.org-json.version>20240303</dependency.org-json.version>
|
||||
<dependency.commons-dbcp.version>2.12.0</dependency.commons-dbcp.version>
|
||||
<dependency.commons-io.version>2.17.0</dependency.commons-io.version>
|
||||
<dependency.commons-io.version>2.18.0</dependency.commons-io.version>
|
||||
<dependency.gson.version>2.11.0</dependency.gson.version>
|
||||
<dependency.guava.version>33.3.1-jre</dependency.guava.version>
|
||||
<dependency.httpclient.version>4.5.14</dependency.httpclient.version>
|
||||
<dependency.httpcore.version>4.4.16</dependency.httpcore.version>
|
||||
<dependency.httpcomponents-httpclient5.version>5.2.1</dependency.httpcomponents-httpclient5.version>
|
||||
<dependency.httpcomponents-httpclient5.version>5.4.1</dependency.httpcomponents-httpclient5.version>
|
||||
<dependency.httpcomponents-httpcore5.version>5.3</dependency.httpcomponents-httpcore5.version>
|
||||
<dependency.commons-httpclient.version>3.1-HTTPCLIENT-1265</dependency.commons-httpclient.version>
|
||||
<dependency.xercesImpl.version>2.12.2</dependency.xercesImpl.version>
|
||||
<dependency.slf4j.version>2.0.16</dependency.slf4j.version>
|
||||
<dependency.log4j.version>2.23.1</dependency.log4j.version>
|
||||
<dependency.groovy.version>3.0.22</dependency.groovy.version>
|
||||
<dependency.log4j.version>2.24.2</dependency.log4j.version>
|
||||
<dependency.groovy.version>3.0.23</dependency.groovy.version>
|
||||
<dependency.tika.version>2.9.2</dependency.tika.version>
|
||||
<dependency.truezip.version>7.7.10</dependency.truezip.version>
|
||||
<dependency.poi.version>5.3.0</dependency.poi.version>
|
||||
<dependency.jboss.logging.version>3.5.0.Final</dependency.jboss.logging.version>
|
||||
<dependency.camel.version>4.6.0</dependency.camel.version> <!-- when bumping this version, please keep track/sync with included netty.io dependencies -->
|
||||
<dependency.netty.version>4.1.113.Final</dependency.netty.version> <!-- must be in sync with camels transitive dependencies, e.g.: netty-common -->
|
||||
<dependency.activemq.version>5.18.3</dependency.activemq.version>
|
||||
<dependency.activemq.version>5.18.6</dependency.activemq.version>
|
||||
<dependency.apache-compress.version>1.27.1</dependency.apache-compress.version>
|
||||
<dependency.awaitility.version>4.2.2</dependency.awaitility.version>
|
||||
<dependency.swagger-ui.version>4.1.3</dependency.swagger-ui.version>
|
||||
<dependency.swagger-parser.version>1.0.71</dependency.swagger-parser.version>
|
||||
<dependency.swagger-parser.version>1.0.72</dependency.swagger-parser.version>
|
||||
<dependency.maven-filtering.version>3.1.1</dependency.maven-filtering.version>
|
||||
<dependency.maven-artifact.version>3.8.6</dependency.maven-artifact.version>
|
||||
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
|
||||
<dependency.pooled-jms.version>3.1.6</dependency.pooled-jms.version>
|
||||
<dependency.kxml2.version>2.3.0</dependency.kxml2.version>
|
||||
|
||||
<dependency.jakarta-ee-jaxb-api.version>4.0.2</dependency.jakarta-ee-jaxb-api.version>
|
||||
<dependency.jakarta-ee-jaxb-impl.version>4.0.5</dependency.jakarta-ee-jaxb-impl.version>
|
||||
@@ -154,7 +155,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>23.4.0.67</tag>
|
||||
<tag>25.1.0.9</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -371,7 +372,7 @@
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<version>2.5.0</version>
|
||||
<!-- exclude c3p0 -->
|
||||
<!-- see https://issues.alfresco.com/jira/browse/REPO-3447 -->
|
||||
<exclusions>
|
||||
@@ -465,7 +466,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlbeans</groupId>
|
||||
<artifactId>xmlbeans</artifactId>
|
||||
<version>5.2.1</version>
|
||||
<version>5.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
@@ -703,7 +704,7 @@
|
||||
<dependency>
|
||||
<groupId>com.networknt</groupId>
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>1.5.1</version>
|
||||
<version>1.5.4</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -950,7 +951,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.34</version>
|
||||
<version>1.18.36</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -1015,7 +1016,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -1028,7 +1029,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<version>3.11.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -45,7 +45,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.santuario</groupId>
|
||||
<artifactId>xmlsec</artifactId>
|
||||
<version>4.0.2</version>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
<!-- newer version, see REPO-3133 -->
|
||||
<dependency>
|
||||
@@ -119,7 +119,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>11.0.15</version>
|
||||
<version>11.0.24</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>23.4.0.67</version>
|
||||
<version>25.1.0.9</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
@@ -397,7 +397,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.16</version>
|
||||
<version>3.5.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
@@ -850,12 +850,12 @@
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<complianceLevel>1.8</complianceLevel>
|
||||
<complianceLevel>17</complianceLevel>
|
||||
<outxml>false</outxml>
|
||||
<verbose>true</verbose>
|
||||
<showWeaveInfo>true</showWeaveInfo>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<additionalCompilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
</additionalCompilerArgs>
|
||||
|
@@ -1,493 +1,484 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* A store providing support for content store implementations that provide
|
||||
* routing of content read and write requests based on context.
|
||||
*
|
||||
* @see ContentContext
|
||||
*
|
||||
* @since 2.1
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
public abstract class AbstractRoutingContentStore implements ContentStore
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(AbstractRoutingContentStore.class);
|
||||
|
||||
private String instanceKey = GUID.generate();
|
||||
private SimpleCache<Pair<String, String>, ContentStore> storesByContentUrl;
|
||||
private ReadLock storesCacheReadLock;
|
||||
private WriteLock storesCacheWriteLock;
|
||||
|
||||
protected AbstractRoutingContentStore()
|
||||
{
|
||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
storesCacheReadLock = lock.readLock();
|
||||
storesCacheWriteLock = lock.writeLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param storesCache cache of stores used to access URLs
|
||||
*/
|
||||
public void setStoresCache(SimpleCache<Pair<String, String>, ContentStore> storesCache)
|
||||
{
|
||||
this.storesByContentUrl = storesCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a list of all possible stores available for reading or writing
|
||||
*/
|
||||
protected abstract List<ContentStore> getAllStores();
|
||||
|
||||
/**
|
||||
* Get a content store based on the context provided. The applicability of the
|
||||
* context and even the types of context allowed are up to the implementation, but
|
||||
* normally there should be a fallback case for when the parameters are not adequate
|
||||
* to make a decision.
|
||||
*
|
||||
* @param ctx the context to use to make the choice
|
||||
* @return Returns the store most appropriate for the given context and
|
||||
* <b>never <tt>null</tt></b>
|
||||
*/
|
||||
protected abstract ContentStore selectWriteStore(ContentContext ctx);
|
||||
|
||||
/**
|
||||
* Checks the cache for the store and ensures that the URL is in the store.
|
||||
*
|
||||
* @param contentUrl the content URL to search for
|
||||
* @return Returns the store matching the content URL
|
||||
*/
|
||||
private ContentStore selectReadStore(String contentUrl)
|
||||
{
|
||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||
storesCacheReadLock.lock();
|
||||
try
|
||||
{
|
||||
// Check if the store is in the cache
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null)
|
||||
{
|
||||
// We found a store that was previously used
|
||||
try
|
||||
{
|
||||
// It is possible for content to be removed from a store and
|
||||
// it might have moved into another store.
|
||||
if (store.exists(contentUrl))
|
||||
{
|
||||
// We found a store and can use it
|
||||
return store;
|
||||
}
|
||||
}
|
||||
catch (UnsupportedContentUrlException e)
|
||||
{
|
||||
// This is odd. The store that previously supported the content URL
|
||||
// no longer does so. I can't think of a reason why that would be.
|
||||
throw new AlfrescoRuntimeException(
|
||||
"Found a content store that previously supported a URL, but no longer does: \n" +
|
||||
" Store: " + store + "\n" +
|
||||
" Content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheReadLock.unlock();
|
||||
}
|
||||
// Get the write lock and double check
|
||||
storesCacheWriteLock.lock();
|
||||
try
|
||||
{
|
||||
// Double check
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null && store.exists(contentUrl))
|
||||
{
|
||||
// We found a store and can use it
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Found mapped store for content URL: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
else
|
||||
{
|
||||
store = null;
|
||||
}
|
||||
// It isn't, so search all the stores
|
||||
List<ContentStore> stores = getAllStores();
|
||||
// Keep track of the unsupported state of the content URL - it might be a rubbish URL
|
||||
boolean contentUrlSupported = false;
|
||||
for (ContentStore storeInList : stores)
|
||||
{
|
||||
boolean exists = false;
|
||||
try
|
||||
{
|
||||
exists = storeInList.exists(contentUrl);
|
||||
// At least the content URL was supported
|
||||
contentUrlSupported = true;
|
||||
}
|
||||
catch (UnsupportedContentUrlException e)
|
||||
{
|
||||
// The store can't handle the content URL
|
||||
}
|
||||
if (!exists)
|
||||
{
|
||||
// It is not in the store
|
||||
continue;
|
||||
}
|
||||
// We found one
|
||||
store = storeInList;
|
||||
// Put the value in the cache
|
||||
storesByContentUrl.put(cacheKey, store);
|
||||
break;
|
||||
}
|
||||
// Check if the content URL was supported
|
||||
if (!contentUrlSupported)
|
||||
{
|
||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Mapped content URL to store for reading: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if the URL is supported by any of the stores.
|
||||
*/
|
||||
public boolean isContentUrlSupported(String contentUrl)
|
||||
{
|
||||
List<ContentStore> stores = getAllStores();
|
||||
boolean supported = false;
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isContentUrlSupported(contentUrl))
|
||||
{
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("The url " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if write is supported by any of the stores.
|
||||
*/
|
||||
public boolean isWriteSupported()
|
||||
{
|
||||
List<ContentStore> stores = getAllStores();
|
||||
boolean supported = false;
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isWriteSupported())
|
||||
{
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Writing " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <b>.</b> always
|
||||
*/
|
||||
public String getRootLocation()
|
||||
{
|
||||
return ".";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>-1</tt> always
|
||||
*/
|
||||
@Override
|
||||
public long getSpaceFree()
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>-1</tt> always
|
||||
*/
|
||||
@Override
|
||||
public long getSpaceTotal()
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #selectReadStore(String)
|
||||
*/
|
||||
public boolean exists(String contentUrl) throws ContentIOException
|
||||
{
|
||||
ContentStore store = selectReadStore(contentUrl);
|
||||
return (store != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a valid reader from one of the stores otherwise
|
||||
* a {@link EmptyContentReader} is returned.
|
||||
*/
|
||||
public ContentReader getReader(String contentUrl) throws ContentIOException
|
||||
{
|
||||
ContentStore store = selectReadStore(contentUrl);
|
||||
if (store != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting reader from store: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store.getReader(contentUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting empty reader for content URL: " + contentUrl);
|
||||
}
|
||||
return new EmptyContentReader(contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects a store for the given context and caches store that was used.
|
||||
*
|
||||
* @see #selectWriteStore(ContentContext)
|
||||
*/
|
||||
public ContentWriter getWriter(ContentContext context) throws ContentIOException
|
||||
{
|
||||
String contentUrl = context.getContentUrl();
|
||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||
if (contentUrl != null)
|
||||
{
|
||||
// Check to see if it is in the cache
|
||||
storesCacheReadLock.lock();
|
||||
try
|
||||
{
|
||||
// Check if the store is in the cache
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null)
|
||||
{
|
||||
throw new ContentExistsException(this, contentUrl);
|
||||
}
|
||||
/*
|
||||
* We could go further and check each store for the existence of the URL,
|
||||
* but that would be overkill. The main problem we need to prevent is
|
||||
* the simultaneous access of the same store. The router represents
|
||||
* a single store and therefore if the URL is present in any of the stores,
|
||||
* it is effectively present in all of them.
|
||||
*/
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheReadLock.unlock();
|
||||
}
|
||||
}
|
||||
// Select the store for writing
|
||||
ContentStore store = selectWriteStore(context);
|
||||
// Check that we were given a valid store
|
||||
if (store == null)
|
||||
{
|
||||
throw new NullPointerException(
|
||||
"Unable to find a writer. 'selectWriteStore' may not return null: \n" +
|
||||
" Router: " + this + "\n" +
|
||||
" Chose: " + store);
|
||||
}
|
||||
else if (!store.isWriteSupported())
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"A write store was chosen that doesn't support writes: \n" +
|
||||
" Router: " + this + "\n" +
|
||||
" Chose: " + store);
|
||||
}
|
||||
ContentWriter writer = store.getWriter(context);
|
||||
String newContentUrl = writer.getContentUrl();
|
||||
Pair<String, String> newCacheKey = new Pair<String, String>(instanceKey, newContentUrl);
|
||||
// Cache the store against the URL
|
||||
storesCacheWriteLock.lock();
|
||||
try
|
||||
{
|
||||
storesByContentUrl.put(newCacheKey, store);
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheWriteLock.unlock();
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Got writer and cache URL from store: \n" +
|
||||
" Context: " + context + "\n" +
|
||||
" Writer: " + writer + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl) throws ContentIOException
|
||||
{
|
||||
return getWriter(new ContentContext(existingContentReader, newContentUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
* This operation has to be performed on all the stores in order to maintain the
|
||||
* {@link ContentStore#exists(String)} contract.
|
||||
*/
|
||||
public boolean delete(String contentUrl) throws ContentIOException
|
||||
{
|
||||
boolean deleted = true;
|
||||
List<ContentStore> stores = getAllStores();
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isWriteSupported())
|
||||
{
|
||||
deleted &= store.delete(contentUrl);
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleted content URL from stores: \n" +
|
||||
" Stores: " + stores.size() + "\n" +
|
||||
" Deleted: " + deleted);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
ContentStore contentStore = selectReadStore(contentUrl);
|
||||
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
final String message = "Getting storage properties from store: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
|
||||
return contentStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams)
|
||||
{
|
||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return ContentStore.super.requestSendContentToArchive(contentUrl, archiveParams);
|
||||
}
|
||||
final String message = "Sending content to archive: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
return contentStore.requestSendContentToArchive(contentUrl, archiveParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams)
|
||||
{
|
||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||
}
|
||||
final String message = "Restoring content from archive: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||
}
|
||||
|
||||
private void logExecution(final String contentUrl, final ContentStore contentStore, final String message)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(message + "\n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + contentStore);
|
||||
}
|
||||
}
|
||||
|
||||
private void logNoContentStore(String contentUrl)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("Content Store not found for content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.content;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.cache.SimpleCache;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.Pair;
|
||||
|
||||
/**
|
||||
* A store providing support for content store implementations that provide routing of content read and write requests based on context.
|
||||
*
|
||||
* @see ContentContext
|
||||
*
|
||||
* @since 2.1
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
public abstract class AbstractRoutingContentStore implements ContentStore
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(AbstractRoutingContentStore.class);
|
||||
|
||||
private String instanceKey = GUID.generate();
|
||||
private SimpleCache<Pair<String, String>, ContentStore> storesByContentUrl;
|
||||
private ReadLock storesCacheReadLock;
|
||||
private WriteLock storesCacheWriteLock;
|
||||
|
||||
protected AbstractRoutingContentStore()
|
||||
{
|
||||
ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
storesCacheReadLock = lock.readLock();
|
||||
storesCacheWriteLock = lock.writeLock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param storesCache
|
||||
* cache of stores used to access URLs
|
||||
*/
|
||||
public void setStoresCache(SimpleCache<Pair<String, String>, ContentStore> storesCache)
|
||||
{
|
||||
this.storesByContentUrl = storesCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a list of all possible stores available for reading or writing
|
||||
*/
|
||||
protected abstract List<ContentStore> getAllStores();
|
||||
|
||||
/**
|
||||
* Get a content store based on the context provided. The applicability of the context and even the types of context allowed are up to the implementation, but normally there should be a fallback case for when the parameters are not adequate to make a decision.
|
||||
*
|
||||
* @param ctx
|
||||
* the context to use to make the choice
|
||||
* @return Returns the store most appropriate for the given context and <b>never <tt>null</tt></b>
|
||||
*/
|
||||
protected abstract ContentStore selectWriteStore(ContentContext ctx);
|
||||
|
||||
/**
|
||||
* Checks the cache for the store and ensures that the URL is in the store.
|
||||
*
|
||||
* @param contentUrl
|
||||
* the content URL to search for
|
||||
* @return Returns the store matching the content URL
|
||||
*/
|
||||
private ContentStore selectReadStore(String contentUrl)
|
||||
{
|
||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||
storesCacheReadLock.lock();
|
||||
try
|
||||
{
|
||||
// Check if the store is in the cache
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null)
|
||||
{
|
||||
// We found a store that was previously used
|
||||
try
|
||||
{
|
||||
// It is possible for content to be removed from a store and
|
||||
// it might have moved into another store.
|
||||
if (store.exists(contentUrl))
|
||||
{
|
||||
// We found a store and can use it
|
||||
return store;
|
||||
}
|
||||
}
|
||||
catch (UnsupportedContentUrlException e)
|
||||
{
|
||||
// This is odd. The store that previously supported the content URL
|
||||
// no longer does so. I can't think of a reason why that would be.
|
||||
throw new AlfrescoRuntimeException(
|
||||
"Found a content store that previously supported a URL, but no longer does: \n" +
|
||||
" Store: " + store + "\n" +
|
||||
" Content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheReadLock.unlock();
|
||||
}
|
||||
// Get the write lock and double check
|
||||
storesCacheWriteLock.lock();
|
||||
try
|
||||
{
|
||||
// Double check
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null && store.exists(contentUrl))
|
||||
{
|
||||
// We found a store and can use it
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Found mapped store for content URL: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
else
|
||||
{
|
||||
store = null;
|
||||
}
|
||||
// It isn't, so search all the stores
|
||||
List<ContentStore> stores = getAllStores();
|
||||
// Keep track of the unsupported state of the content URL - it might be a rubbish URL
|
||||
boolean contentUrlSupported = false;
|
||||
for (ContentStore storeInList : stores)
|
||||
{
|
||||
boolean exists = false;
|
||||
try
|
||||
{
|
||||
exists = storeInList.exists(contentUrl);
|
||||
// At least the content URL was supported
|
||||
contentUrlSupported = true;
|
||||
}
|
||||
catch (UnsupportedContentUrlException e)
|
||||
{
|
||||
// The store can't handle the content URL
|
||||
}
|
||||
if (!exists)
|
||||
{
|
||||
// It is not in the store
|
||||
continue;
|
||||
}
|
||||
// We found one
|
||||
store = storeInList;
|
||||
// Put the value in the cache
|
||||
storesByContentUrl.put(cacheKey, store);
|
||||
break;
|
||||
}
|
||||
// Check if the content URL was supported
|
||||
if (!contentUrlSupported)
|
||||
{
|
||||
throw new UnsupportedContentUrlException(this, contentUrl);
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Mapped content URL to store for reading: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store;
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if the URL is supported by any of the stores.
|
||||
*/
|
||||
public boolean isContentUrlSupported(String contentUrl)
|
||||
{
|
||||
List<ContentStore> stores = getAllStores();
|
||||
boolean supported = false;
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isContentUrlSupported(contentUrl))
|
||||
{
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("The url " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if write is supported by any of the stores.
|
||||
*/
|
||||
public boolean isWriteSupported()
|
||||
{
|
||||
List<ContentStore> stores = getAllStores();
|
||||
boolean supported = false;
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isWriteSupported())
|
||||
{
|
||||
supported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Writing " + (supported ? "is" : "is not") + " supported by at least one store.");
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <b>.</b> always
|
||||
*/
|
||||
public String getRootLocation()
|
||||
{
|
||||
return ".";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>-1</tt> always
|
||||
*/
|
||||
@Override
|
||||
public long getSpaceFree()
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>-1</tt> always
|
||||
*/
|
||||
@Override
|
||||
public long getSpaceTotal()
|
||||
{
|
||||
return -1L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #selectReadStore(String)
|
||||
*/
|
||||
public boolean exists(String contentUrl) throws ContentIOException
|
||||
{
|
||||
ContentStore store = selectReadStore(contentUrl);
|
||||
return (store != null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a valid reader from one of the stores otherwise a {@link EmptyContentReader} is returned.
|
||||
*/
|
||||
public ContentReader getReader(String contentUrl) throws ContentIOException
|
||||
{
|
||||
ContentStore store = selectReadStore(contentUrl);
|
||||
if (store != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting reader from store: \n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return store.getReader(contentUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting empty reader for content URL: " + contentUrl);
|
||||
}
|
||||
return new EmptyContentReader(contentUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects a store for the given context and caches store that was used.
|
||||
*
|
||||
* @see #selectWriteStore(ContentContext)
|
||||
*/
|
||||
public ContentWriter getWriter(ContentContext context) throws ContentIOException
|
||||
{
|
||||
String contentUrl = context.getContentUrl();
|
||||
Pair<String, String> cacheKey = new Pair<String, String>(instanceKey, contentUrl);
|
||||
if (contentUrl != null)
|
||||
{
|
||||
// Check to see if it is in the cache
|
||||
storesCacheReadLock.lock();
|
||||
try
|
||||
{
|
||||
// Check if the store is in the cache
|
||||
ContentStore store = storesByContentUrl.get(cacheKey);
|
||||
if (store != null)
|
||||
{
|
||||
throw new ContentExistsException(this, contentUrl);
|
||||
}
|
||||
/* We could go further and check each store for the existence of the URL, but that would be overkill. The main problem we need to prevent is the simultaneous access of the same store. The router represents a single store and therefore if the URL is present in any of the stores, it is effectively present in all of them. */
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheReadLock.unlock();
|
||||
}
|
||||
}
|
||||
// Select the store for writing
|
||||
ContentStore store = selectWriteStore(context);
|
||||
// Check that we were given a valid store
|
||||
if (store == null)
|
||||
{
|
||||
throw new NullPointerException(
|
||||
"Unable to find a writer. 'selectWriteStore' may not return null: \n" +
|
||||
" Router: " + this + "\n" +
|
||||
" Chose: " + store);
|
||||
}
|
||||
else if (!store.isWriteSupported())
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"A write store was chosen that doesn't support writes: \n" +
|
||||
" Router: " + this + "\n" +
|
||||
" Chose: " + store);
|
||||
}
|
||||
ContentWriter writer = store.getWriter(context);
|
||||
String newContentUrl = writer.getContentUrl();
|
||||
Pair<String, String> newCacheKey = new Pair<String, String>(instanceKey, newContentUrl);
|
||||
// Cache the store against the URL
|
||||
storesCacheWriteLock.lock();
|
||||
try
|
||||
{
|
||||
storesByContentUrl.put(newCacheKey, store);
|
||||
}
|
||||
finally
|
||||
{
|
||||
storesCacheWriteLock.unlock();
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Got writer and cache URL from store: \n" +
|
||||
" Context: " + context + "\n" +
|
||||
" Writer: " + writer + "\n" +
|
||||
" Store: " + store);
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
public ContentWriter getWriter(ContentReader existingContentReader, String newContentUrl) throws ContentIOException
|
||||
{
|
||||
return getWriter(new ContentContext(existingContentReader, newContentUrl));
|
||||
}
|
||||
|
||||
/**
|
||||
* This operation has to be performed on all the stores in order to maintain the {@link ContentStore#exists(String)} contract.
|
||||
*/
|
||||
public boolean delete(String contentUrl) throws ContentIOException
|
||||
{
|
||||
boolean deleted = true;
|
||||
List<ContentStore> stores = getAllStores();
|
||||
for (ContentStore store : stores)
|
||||
{
|
||||
if (store.isWriteSupported())
|
||||
{
|
||||
deleted &= store.delete(contentUrl);
|
||||
}
|
||||
}
|
||||
// Done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Deleted content URL from stores: \n" +
|
||||
" Stores: " + stores.size() + "\n" +
|
||||
" Deleted: " + deleted);
|
||||
}
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getStorageProperties(String contentUrl)
|
||||
{
|
||||
ContentStore contentStore = selectReadStore(contentUrl);
|
||||
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
final String message = "Getting storage properties from store: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
|
||||
return contentStore.getStorageProperties(contentUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams)
|
||||
{
|
||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return ContentStore.super.requestSendContentToArchive(contentUrl, archiveParams);
|
||||
}
|
||||
final String message = "Sending content to archive: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
return contentStore.requestSendContentToArchive(contentUrl, archiveParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams)
|
||||
{
|
||||
final ContentStore contentStore = selectReadStore(contentUrl);
|
||||
if (contentStore == null)
|
||||
{
|
||||
logNoContentStore(contentUrl);
|
||||
return ContentStore.super.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||
}
|
||||
final String message = "Restoring content from archive: ";
|
||||
logExecution(contentUrl, contentStore, message);
|
||||
return contentStore.requestRestoreContentFromArchive(contentUrl, restoreParams);
|
||||
}
|
||||
|
||||
private void logExecution(final String contentUrl, final ContentStore contentStore, final String message)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace(message + "\n" +
|
||||
" Content URL: " + contentUrl + "\n" +
|
||||
" Store: " + contentStore);
|
||||
}
|
||||
}
|
||||
|
||||
private void logNoContentStore(String contentUrl)
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("Content Store not found for content URL: " + contentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,329 +1,344 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.download;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.Date;
|
||||
import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.download.DownloadStatus;
|
||||
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.view.ExporterContext;
|
||||
import org.alfresco.service.cmr.view.ExporterException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Handler for exporting node content to a ZIP file
|
||||
*
|
||||
* @author Alex Miller
|
||||
*/
|
||||
public class ZipDownloadExporter extends BaseExporter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(ZipDownloadExporter.class);
|
||||
|
||||
private static final String PATH_SEPARATOR = "/";
|
||||
|
||||
protected ZipArchiveOutputStream zipStream;
|
||||
|
||||
private NodeRef downloadNodeRef;
|
||||
private int sequenceNumber = 1;
|
||||
private long total;
|
||||
private long done;
|
||||
private long totalFileCount;
|
||||
private long filesAddedCount;
|
||||
|
||||
private RetryingTransactionHelper transactionHelper;
|
||||
private DownloadStorage downloadStorage;
|
||||
private DictionaryService dictionaryService;
|
||||
private DownloadStatusUpdateService updateService;
|
||||
|
||||
private Deque<Pair<String, NodeRef>> path = new LinkedList<Pair<String, NodeRef>>();
|
||||
private String currentName;
|
||||
|
||||
private OutputStream outputStream;
|
||||
private Date zipTimestampCreated;
|
||||
private Date zipTimestampModified;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param zipFile File
|
||||
* @param checkOutCheckInService CheckOutCheckInService
|
||||
* @param nodeService NodeService
|
||||
* @param transactionHelper RetryingTransactionHelper
|
||||
* @param updateService DownloadStatusUpdateService
|
||||
* @param downloadStorage DownloadStorage
|
||||
* @param dictionaryService DictionaryService
|
||||
* @param downloadNodeRef NodeRef
|
||||
* @param total long
|
||||
* @param totalFileCount long
|
||||
*/
|
||||
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService, RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService, DownloadStorage downloadStorage, DictionaryService dictionaryService, NodeRef downloadNodeRef, long total, long totalFileCount)
|
||||
{
|
||||
super(checkOutCheckInService, nodeService);
|
||||
try
|
||||
{
|
||||
this.outputStream = new FileOutputStream(zipFile);
|
||||
this.updateService = updateService;
|
||||
this.transactionHelper = transactionHelper;
|
||||
this.downloadStorage = downloadStorage;
|
||||
this.dictionaryService = dictionaryService;
|
||||
|
||||
this.downloadNodeRef = downloadNodeRef;
|
||||
this.total = total;
|
||||
this.totalFileCount = totalFileCount;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new ExporterException("Failed to create zip file", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final ExporterContext context)
|
||||
{
|
||||
zipStream = new ZipArchiveOutputStream(outputStream);
|
||||
// NOTE: This encoding allows us to workaround bug...
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
|
||||
zipStream.setEncoding("UTF-8");
|
||||
zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
|
||||
zipStream.setUseLanguageEncodingFlag(true);
|
||||
zipStream.setFallbackToUTF8(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNode(NodeRef nodeRef)
|
||||
{
|
||||
this.currentName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
this.zipTimestampCreated = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
|
||||
this.zipTimestampModified = (Date)nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
path.push(new Pair<String, NodeRef>(currentName, nodeRef));
|
||||
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
String path = getPath() + PATH_SEPARATOR;
|
||||
ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);
|
||||
try
|
||||
{
|
||||
archiveEntry.setTime(zipTimestampCreated.getTime());
|
||||
archiveEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||
archiveEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||
zipStream.putArchiveEntry(archiveEntry);
|
||||
zipStream.closeArchiveEntry();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ExporterException("Unexpected IOException adding folder entry", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contentImpl(NodeRef nodeRef, QName property, InputStream content, ContentData contentData, int index)
|
||||
{
|
||||
// if the content stream to output is empty, then just return content descriptor as is
|
||||
if (content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Archiving content for nodeRef: "+nodeRef+" with contentURL: "+contentData.getContentUrl());
|
||||
}
|
||||
// ALF-2016
|
||||
ZipArchiveEntry zipEntry=new ZipArchiveEntry(getPath());
|
||||
zipEntry.setTime(zipTimestampCreated.getTime());
|
||||
zipEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||
zipEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||
zipStream.putArchiveEntry(zipEntry);
|
||||
|
||||
// copy export stream to zip
|
||||
copyStream(zipStream, content);
|
||||
|
||||
zipStream.closeArchiveEntry();
|
||||
filesAddedCount = filesAddedCount + 1;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ExporterException("Failed to zip export stream", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endNode(NodeRef nodeRef)
|
||||
{
|
||||
path.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end()
|
||||
{
|
||||
try
|
||||
{
|
||||
zipStream.close();
|
||||
}
|
||||
catch (IOException error)
|
||||
{
|
||||
throw new ExporterException("Unexpected error closing zip stream!", error);
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath()
|
||||
{
|
||||
if (path.size() < 1)
|
||||
{
|
||||
throw new IllegalStateException("No elements in path!");
|
||||
}
|
||||
|
||||
Iterator<Pair<String, NodeRef>> iter = path.descendingIterator();
|
||||
StringBuilder pathBuilder = new StringBuilder();
|
||||
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Pair<String, NodeRef> element = iter.next();
|
||||
|
||||
pathBuilder.append(element.getFirst());
|
||||
if (iter.hasNext())
|
||||
{
|
||||
pathBuilder.append(PATH_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
return pathBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy input stream to output stream
|
||||
*
|
||||
* @param output output stream
|
||||
* @param in input stream
|
||||
* @throws IOException
|
||||
*/
|
||||
private void copyStream(OutputStream output, InputStream in)
|
||||
throws IOException
|
||||
{
|
||||
byte[] buffer = new byte[2048 * 10];
|
||||
int read = in.read(buffer, 0, 2048 *10);
|
||||
int i = 0;
|
||||
while (read != -1)
|
||||
{
|
||||
output.write(buffer, 0, read);
|
||||
done = done + read;
|
||||
|
||||
// ALF-16289 - only update the status every 10MB
|
||||
if (i++%500 == 0)
|
||||
{
|
||||
updateStatus();
|
||||
checkCancelled();
|
||||
}
|
||||
|
||||
read = in.read(buffer, 0, 2048 *10);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCancelled()
|
||||
{
|
||||
boolean downloadCancelled = transactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public Boolean execute() throws Throwable
|
||||
{
|
||||
return downloadStorage.isCancelled(downloadNodeRef);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
if ( downloadCancelled == true)
|
||||
{
|
||||
log.debug("Download cancelled");
|
||||
throw new DownloadCancelledException();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatus()
|
||||
{
|
||||
transactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
DownloadStatus status = new DownloadStatus(Status.IN_PROGRESS, done, total, filesAddedCount, totalFileCount);
|
||||
|
||||
updateService.update(downloadNodeRef, status, getNextSequenceNumber());
|
||||
return null;
|
||||
}
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
public int getNextSequenceNumber()
|
||||
{
|
||||
return sequenceNumber++;
|
||||
}
|
||||
|
||||
public long getDone()
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public long getFilesAdded()
|
||||
{
|
||||
return filesAddedCount;
|
||||
}
|
||||
|
||||
public long getTotalFiles()
|
||||
{
|
||||
return totalFileCount;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.download;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.util.Date;
|
||||
import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.download.DownloadStatus;
|
||||
import org.alfresco.service.cmr.download.DownloadStatus.Status;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.view.ExporterContext;
|
||||
import org.alfresco.service.cmr.view.ExporterException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
|
||||
/**
|
||||
* Handler for exporting node content to a ZIP file
|
||||
*
|
||||
* @author Alex Miller
|
||||
*/
|
||||
public class ZipDownloadExporter extends BaseExporter
|
||||
{
|
||||
private static Logger log = LoggerFactory.getLogger(ZipDownloadExporter.class);
|
||||
|
||||
private static final String PATH_SEPARATOR = "/";
|
||||
|
||||
protected ZipArchiveOutputStream zipStream;
|
||||
|
||||
private NodeRef downloadNodeRef;
|
||||
private int sequenceNumber = 1;
|
||||
private long total;
|
||||
private long done;
|
||||
private long totalFileCount;
|
||||
private long filesAddedCount;
|
||||
|
||||
private RetryingTransactionHelper transactionHelper;
|
||||
private DownloadStorage downloadStorage;
|
||||
private DictionaryService dictionaryService;
|
||||
private DownloadStatusUpdateService updateService;
|
||||
|
||||
private Deque<Pair<String, NodeRef>> path = new LinkedList<Pair<String, NodeRef>>();
|
||||
private String currentName;
|
||||
|
||||
private OutputStream outputStream;
|
||||
private Date zipTimestampCreated;
|
||||
private Date zipTimestampModified;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param zipFile
|
||||
* File
|
||||
* @param checkOutCheckInService
|
||||
* CheckOutCheckInService
|
||||
* @param nodeService
|
||||
* NodeService
|
||||
* @param transactionHelper
|
||||
* RetryingTransactionHelper
|
||||
* @param updateService
|
||||
* DownloadStatusUpdateService
|
||||
* @param downloadStorage
|
||||
* DownloadStorage
|
||||
* @param dictionaryService
|
||||
* DictionaryService
|
||||
* @param downloadNodeRef
|
||||
* NodeRef
|
||||
* @param total
|
||||
* long
|
||||
* @param totalFileCount
|
||||
* long
|
||||
*/
|
||||
public ZipDownloadExporter(File zipFile, CheckOutCheckInService checkOutCheckInService, NodeService nodeService,
|
||||
RetryingTransactionHelper transactionHelper, DownloadStatusUpdateService updateService,
|
||||
DownloadStorage downloadStorage, DictionaryService dictionaryService,
|
||||
NodeRef downloadNodeRef, long total, long totalFileCount)
|
||||
{
|
||||
super(checkOutCheckInService, nodeService);
|
||||
try
|
||||
{
|
||||
this.outputStream = new FileOutputStream(zipFile);
|
||||
this.updateService = updateService;
|
||||
this.transactionHelper = transactionHelper;
|
||||
this.downloadStorage = downloadStorage;
|
||||
this.dictionaryService = dictionaryService;
|
||||
|
||||
this.downloadNodeRef = downloadNodeRef;
|
||||
this.total = total;
|
||||
this.totalFileCount = totalFileCount;
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new ExporterException("Failed to create zip file", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final ExporterContext context)
|
||||
{
|
||||
zipStream = new ZipArchiveOutputStream(outputStream);
|
||||
// NOTE: This encoding allows us to workaround bug...
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
|
||||
zipStream.setEncoding("UTF-8");
|
||||
zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
|
||||
zipStream.setUseLanguageEncodingFlag(true);
|
||||
zipStream.setFallbackToUTF8(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNode(NodeRef nodeRef)
|
||||
{
|
||||
this.currentName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
this.zipTimestampCreated = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
|
||||
this.zipTimestampModified = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
path.push(new Pair<String, NodeRef>(currentName, nodeRef));
|
||||
if (dictionaryService.isSubClass(nodeService.getType(nodeRef), ContentModel.TYPE_FOLDER))
|
||||
{
|
||||
String path = getPath() + PATH_SEPARATOR;
|
||||
ZipArchiveEntry archiveEntry = new ZipArchiveEntry(path);
|
||||
try
|
||||
{
|
||||
archiveEntry.setTime(zipTimestampCreated.getTime());
|
||||
archiveEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||
archiveEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||
zipStream.putArchiveEntry(archiveEntry);
|
||||
zipStream.closeArchiveEntry();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ExporterException("Unexpected IOException adding folder entry", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contentImpl(NodeRef nodeRef, QName property, InputStream content, ContentData contentData, int index)
|
||||
{
|
||||
// if the content stream to output is empty, then just return content descriptor as is
|
||||
if (content == null)
|
||||
{
|
||||
log.info("Archiving content has been removed or modified for the specified NodeReference: " + nodeRef
|
||||
+ ", and the size of the content is " + contentData.getSize());
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (log.isDebugEnabled())
|
||||
{
|
||||
log.debug("Archiving content for nodeRef: " + nodeRef + " with contentURL: "
|
||||
+ contentData.getContentUrl());
|
||||
}
|
||||
// ALF-2016
|
||||
ZipArchiveEntry zipEntry = new ZipArchiveEntry(getPath());
|
||||
zipEntry.setTime(zipTimestampCreated.getTime());
|
||||
zipEntry.setCreationTime(FileTime.fromMillis(zipTimestampCreated.getTime()));
|
||||
zipEntry.setLastModifiedTime(FileTime.fromMillis(zipTimestampModified.getTime()));
|
||||
zipStream.putArchiveEntry(zipEntry);
|
||||
|
||||
// copy export stream to zip
|
||||
copyStream(zipStream, content);
|
||||
|
||||
zipStream.closeArchiveEntry();
|
||||
filesAddedCount = filesAddedCount + 1;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ExporterException("Failed to zip export stream", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endNode(NodeRef nodeRef)
|
||||
{
|
||||
path.pop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end()
|
||||
{
|
||||
try
|
||||
{
|
||||
zipStream.close();
|
||||
}
|
||||
catch (IOException error)
|
||||
{
|
||||
throw new ExporterException("Unexpected error closing zip stream!", error);
|
||||
}
|
||||
}
|
||||
|
||||
private String getPath()
|
||||
{
|
||||
if (path.size() < 1)
|
||||
{
|
||||
throw new IllegalStateException("No elements in path!");
|
||||
}
|
||||
|
||||
Iterator<Pair<String, NodeRef>> iter = path.descendingIterator();
|
||||
StringBuilder pathBuilder = new StringBuilder();
|
||||
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Pair<String, NodeRef> element = iter.next();
|
||||
|
||||
pathBuilder.append(element.getFirst());
|
||||
if (iter.hasNext())
|
||||
{
|
||||
pathBuilder.append(PATH_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
return pathBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy input stream to output stream
|
||||
*
|
||||
* @param output
|
||||
* output stream
|
||||
* @param in
|
||||
* input stream
|
||||
* @throws IOException
|
||||
*/
|
||||
private void copyStream(OutputStream output, InputStream in) throws IOException
|
||||
{
|
||||
byte[] buffer = new byte[2048 * 10];
|
||||
int read = in.read(buffer, 0, 2048 * 10);
|
||||
int i = 0;
|
||||
while (read != -1)
|
||||
{
|
||||
output.write(buffer, 0, read);
|
||||
done = done + read;
|
||||
|
||||
// ALF-16289 - only update the status every 10MB
|
||||
if (i++ % 500 == 0)
|
||||
{
|
||||
updateStatus();
|
||||
checkCancelled();
|
||||
}
|
||||
|
||||
read = in.read(buffer, 0, 2048 * 10);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkCancelled()
|
||||
{
|
||||
boolean downloadCancelled = transactionHelper.doInTransaction(new RetryingTransactionCallback<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute() throws Throwable
|
||||
{
|
||||
return downloadStorage.isCancelled(downloadNodeRef);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
if (downloadCancelled == true)
|
||||
{
|
||||
log.debug("Download cancelled");
|
||||
throw new DownloadCancelledException();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateStatus()
|
||||
{
|
||||
transactionHelper.doInTransaction(new RetryingTransactionCallback<Object>() {
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
DownloadStatus status = new DownloadStatus(Status.IN_PROGRESS, done, total, filesAddedCount, totalFileCount);
|
||||
|
||||
updateService.update(downloadNodeRef, status, getNextSequenceNumber());
|
||||
return null;
|
||||
}
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
public int getNextSequenceNumber()
|
||||
{
|
||||
return sequenceNumber++;
|
||||
}
|
||||
|
||||
public long getDone()
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
public long getTotal()
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
public long getFilesAdded()
|
||||
{
|
||||
return filesAddedCount;
|
||||
}
|
||||
|
||||
public long getTotalFiles()
|
||||
{
|
||||
return totalFileCount;
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,14 +25,15 @@
|
||||
*/
|
||||
package org.alfresco.repo.site;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.query.CannedQuerySortDetails;
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.util.Pair;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Conveys information for a member of a site.
|
||||
*
|
||||
@@ -52,7 +53,7 @@ public class SiteMembership extends AbstractSiteMembership
|
||||
public SiteMembership(SiteInfo siteInfo, String id, String firstName, String lastName,
|
||||
String role)
|
||||
{
|
||||
super(siteInfo,id, role);
|
||||
super(siteInfo, id, role);
|
||||
if (firstName == null)
|
||||
{
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
@@ -76,13 +77,8 @@ public class SiteMembership extends AbstractSiteMembership
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"FirstName required building site membership of " + siteInfo.getShortName());
|
||||
}
|
||||
if (lastName == null)
|
||||
{
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"LastName required building site membership of " + siteInfo.getShortName());
|
||||
}
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
this.lastName = Optional.ofNullable(lastName).orElse("");
|
||||
this.isMemberOfGroup = isMemberOfGroup;
|
||||
}
|
||||
|
||||
@@ -164,7 +160,6 @@ public class SiteMembership extends AbstractSiteMembership
|
||||
", isMemberOfGroup = " + isMemberOfGroup + "]";
|
||||
}
|
||||
|
||||
|
||||
static int compareTo(List<Pair<? extends Object, CannedQuerySortDetails.SortOrder>> sortPairs, SiteMembership o1, SiteMembership o2)
|
||||
{
|
||||
String personId1 = o1.getPersonId();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
repository.name=Main Repository
|
||||
|
||||
# Schema number
|
||||
version.schema=19300
|
||||
version.schema=20000
|
||||
|
||||
# Directory configuration
|
||||
|
||||
|
@@ -1,136 +1,137 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.site;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test Membership constructor logs. Based on REPO-2520
|
||||
*
|
||||
* @author Alexandru Epure
|
||||
*/
|
||||
public class SiteMembershipTest
|
||||
{
|
||||
SiteInfo siteInfo;
|
||||
SiteMembership siteMember;
|
||||
String personId = UUID.randomUUID().toString();
|
||||
String firstName = UUID.randomUUID().toString();
|
||||
String lastName = UUID.randomUUID().toString();
|
||||
String role = "Consumer";
|
||||
|
||||
String idErrorMessage = "Id required building site membership";
|
||||
String firstNameErrorMessage = "FirstName required building site membership of ";
|
||||
String lastNameErrorMessage = "LastName required building site membership of ";
|
||||
String roleErrorMessage = "Role required building site membership";
|
||||
|
||||
@Before
|
||||
public void createSite()
|
||||
{
|
||||
String sitePreset = "testSiteMembershipPreset";
|
||||
String shortName = "testSiteMembershipShortName";
|
||||
String title = "testSiteMembershipTile";
|
||||
String description = "testSiteMembershipDescription";
|
||||
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
|
||||
SiteVisibility.PUBLIC, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullpersonInfo() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(idErrorMessage, e.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, null, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(idErrorMessage, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullRole() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(roleErrorMessage, e.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, null);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(roleErrorMessage, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullFirstName() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullLastName() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.site;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.alfresco.service.cmr.site.SiteInfo;
|
||||
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||
|
||||
/**
|
||||
* Test Membership constructor logs. Based on REPO-2520
|
||||
*
|
||||
* @author Alexandru Epure
|
||||
*/
|
||||
public class SiteMembershipTest
|
||||
{
|
||||
SiteInfo siteInfo;
|
||||
SiteMembership siteMember;
|
||||
String personId = UUID.randomUUID().toString();
|
||||
String firstName = UUID.randomUUID().toString();
|
||||
String lastName = UUID.randomUUID().toString();
|
||||
String role = "Consumer";
|
||||
|
||||
String idErrorMessage = "Id required building site membership";
|
||||
String firstNameErrorMessage = "FirstName required building site membership of ";
|
||||
String lastNameErrorMessage = "LastName required building site membership of ";
|
||||
String roleErrorMessage = "Role required building site membership";
|
||||
|
||||
@Before
|
||||
public void createSite()
|
||||
{
|
||||
var sitePreset = "testSiteMembershipPreset";
|
||||
var shortName = "testSiteMembershipShortName";
|
||||
var title = "testSiteMembershipTile";
|
||||
var description = "testSiteMembershipDescription";
|
||||
siteInfo = new SiteInfoImpl(sitePreset, shortName, title, description,
|
||||
SiteVisibility.PUBLIC, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullpersonInfo() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, null, firstName, lastName, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(idErrorMessage, e.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, null, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(idErrorMessage, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullRole() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, firstName, lastName, null);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(roleErrorMessage, e.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, null);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(roleErrorMessage, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullFirstName() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, null, lastName, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(firstNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullLastName() throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
siteMember = new SiteMembership(siteInfo, personId, firstName, null, role);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
assertEquals(lastNameErrorMessage + siteInfo.getShortName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user