mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
AIO: Obtain classes and resources from the 5 t-engines
This commit is contained in:
@@ -542,7 +542,7 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
sourceSizeInBytes, targetMimetype, transformOptions, null);
|
||||
if (transformerName == null)
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST, "No transforms were able to handle the request");
|
||||
throw new TransformException(BAD_REQUEST, "No transforms for:");
|
||||
}
|
||||
return transformerName;
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${AIOUSERNAME} && \
|
||||
|
@@ -133,6 +133,50 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Extract classes and licenses from fat Spring Boot jars. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<includeGroupIds>${project.groupId}</includeGroupIds>
|
||||
<includeArtifactIds>alfresco-transform-imagemagick,alfresco-transform-libreoffice,alfresco-transform-misc,alfresco-transform-pdf-renderer,alfresco-transform-tika</includeArtifactIds>
|
||||
<excludeTransitive>true</excludeTransitive>
|
||||
<excludeClassifiers>tests</excludeClassifiers>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
|
||||
<overWriteReleases>true</overWriteReleases>
|
||||
<overWriteSnapshots>true</overWriteSnapshots>
|
||||
<fileMappers>
|
||||
<org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
|
||||
<pattern>BOOT-INF\/</pattern>
|
||||
<replacement>./</replacement>
|
||||
</org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
|
||||
</fileMappers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack-classes</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includes>**/org/alfresco/transform/**/*.class</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>unpack-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>unpack-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>**/*.class,BOOT-INF/lib/**,META-INF/**,org/**,**/*.idx,docker/**,**/application-default.yaml</excludes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
@@ -43,7 +43,6 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
@Component
|
||||
public class AIOTransformEngine implements TransformEngine
|
||||
{
|
||||
// private static String SPLIT_UP_COMMUNITY_LICENCE = Arrays.stream(COMMUNITY_LICENCE.split("\\n"));
|
||||
@Autowired(required = false)
|
||||
private List<TransformEngine> transformEngines;
|
||||
|
||||
|
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@@ -1,107 +0,0 @@
|
||||
The authoritative ImageMagick license can be found at
|
||||
https://imagemagick.org/script/license.php and ImageMagick notices at
|
||||
https://raw.githubusercontent.com/ImageMagick/ImageMagick/main/NOTICE.
|
||||
|
||||
Before we get to the text of the license, lets just review what the license says in simple terms:
|
||||
|
||||
It allows you to:
|
||||
|
||||
* freely download and use ImageMagick software, in whole or in part, for personal, company internal, or commercial purposes;
|
||||
* use ImageMagick software in packages or distributions that you create;
|
||||
* link against a library under a different license;
|
||||
* link code under a different license against a library under this license;
|
||||
* merge code into a work under a different license;
|
||||
* extend patent grants to any code using code under this license;
|
||||
* and extend patent protection.
|
||||
|
||||
It forbids you to:
|
||||
|
||||
* redistribute any piece of ImageMagick-originated software without proper attribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that ImageMagick Studio LLC endorses your distribution;
|
||||
* use any marks owned by ImageMagick Studio LLC in any way that might state or imply that you created the ImageMagick software in question.
|
||||
|
||||
It requires you to:
|
||||
|
||||
* include a copy of the license in any redistribution you may make that includes ImageMagick software;
|
||||
* provide clear attribution to ImageMagick Studio LLC for any distributions that include ImageMagick software.
|
||||
|
||||
It does not require you to:
|
||||
|
||||
* include the source of the ImageMagick software itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it;
|
||||
* submit changes that you make to the software back to the ImageMagick Studio LLC (though such feedback is encouraged).
|
||||
|
||||
A few other clarifications include:
|
||||
|
||||
* ImageMagick is freely available without charge;
|
||||
* you may include ImageMagick on a DVD as long as you comply with the terms of the license;
|
||||
* you can give modified code away for free or sell it under the terms of the ImageMagick license or distribute the result under a different license, but you need to acknowledge the use of the ImageMagick software;
|
||||
* the license is compatible with the GPL V3.
|
||||
* when exporting the ImageMagick software, review its export classification.
|
||||
|
||||
Terms and Conditions for Use, Reproduction, and Distribution
|
||||
|
||||
The legally binding and authoritative terms and conditions for use, reproduction, and distribution of ImageMagick follow:
|
||||
|
||||
Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.
|
||||
|
||||
1. Definitions.
|
||||
|
||||
License shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
Legal Entity shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, control means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
You (or Your) shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
Source form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
Object form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
Work shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
Derivative Works shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
Contribution shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as Not a Contribution.
|
||||
|
||||
Contributor shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
* You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
* You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
* You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
* If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
How to Apply the License to your Work
|
||||
|
||||
To apply the ImageMagick License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information (don't include the brackets). The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the ImageMagick License (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy
|
||||
of the License at
|
||||
|
||||
https://imagemagick.org/script/license.php
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations
|
||||
under the License.
|
@@ -1,127 +0,0 @@
|
||||
The "Artistic License"
|
||||
|
||||
Preamble
|
||||
|
||||
The intent of this document is to state the conditions under which a
|
||||
Package may be copied, such that the Copyright Holder maintains some
|
||||
semblance of artistic control over the development of the package,
|
||||
while giving the users of the package the right to use and distribute
|
||||
the Package in a more-or-less customary fashion, plus the right to make
|
||||
reasonable modifications.
|
||||
|
||||
Definitions:
|
||||
|
||||
"Package" refers to the collection of files distributed by the
|
||||
Copyright Holder, and derivatives of that collection of files
|
||||
created through textual modification.
|
||||
|
||||
"Standard Version" refers to such a Package if it has not been
|
||||
modified, or has been modified in accordance with the wishes
|
||||
of the Copyright Holder as specified below.
|
||||
|
||||
"Copyright Holder" is whoever is named in the copyright or
|
||||
copyrights for the package.
|
||||
|
||||
"You" is you, if you're thinking about copying or distributing
|
||||
this Package.
|
||||
|
||||
"Reasonable copying fee" is whatever you can justify on the
|
||||
basis of media cost, duplication charges, time of people involved,
|
||||
and so on. (You will not be required to justify it to the
|
||||
Copyright Holder, but only to the computing community at large
|
||||
as a market that must bear the fee.)
|
||||
|
||||
"Freely Available" means that no fee is charged for the item
|
||||
itself, though there may be fees involved in handling the item.
|
||||
It also means that recipients of the item may redistribute it
|
||||
under the same conditions they received it.
|
||||
|
||||
1. You may make and give away verbatim copies of the source form of the
|
||||
Standard Version of this Package without restriction, provided that you
|
||||
duplicate all of the original copyright notices and associated disclaimers.
|
||||
|
||||
2. You may apply bug fixes, portability fixes and other modifications
|
||||
derived from the Public Domain or from the Copyright Holder. A Package
|
||||
modified in such a way shall still be considered the Standard Version.
|
||||
|
||||
3. You may otherwise modify your copy of this Package in any way, provided
|
||||
that you insert a prominent notice in each changed file stating how and
|
||||
when you changed that file, and provided that you do at least ONE of the
|
||||
following:
|
||||
|
||||
a) place your modifications in the Public Domain or otherwise make them
|
||||
Freely Available, such as by posting said modifications to Usenet or
|
||||
an equivalent medium, or placing the modifications on a major archive
|
||||
site such as uunet.uu.net, or by allowing the Copyright Holder to include
|
||||
your modifications in the Standard Version of the Package.
|
||||
|
||||
b) use the modified Package only within your corporation or organization.
|
||||
|
||||
c) rename any non-standard executables so the names do not conflict
|
||||
with standard executables, which must also be provided, and provide
|
||||
a separate manual page for each non-standard executable that clearly
|
||||
documents how it differs from the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
4. You may distribute the programs of this Package in object code or
|
||||
executable form, provided that you do at least ONE of the following:
|
||||
|
||||
a) distribute a Standard Version of the executables and library files,
|
||||
together with instructions (in the manual page or equivalent) on where
|
||||
to get the Standard Version.
|
||||
|
||||
b) accompany the distribution with the machine-readable source of
|
||||
the Package with your modifications.
|
||||
|
||||
c) give non-standard executables non-standard names, and clearly
|
||||
document the differences in manual pages (or equivalent), together
|
||||
with instructions on where to get the Standard Version.
|
||||
|
||||
d) make other distribution arrangements with the Copyright Holder.
|
||||
|
||||
5. You may charge a reasonable copying fee for any distribution of this
|
||||
Package. You may charge any fee you choose for support of this
|
||||
Package. You may not charge a fee for this Package itself. However,
|
||||
you may distribute this Package in aggregate with other (possibly
|
||||
commercial) programs as part of a larger (possibly commercial) software
|
||||
distribution provided that you do not advertise this Package as a
|
||||
product of your own. You may embed this Package's interpreter within
|
||||
an executable of yours (by linking); this shall be construed as a mere
|
||||
form of aggregation, provided that the complete Standard Version of the
|
||||
interpreter is so embedded.
|
||||
|
||||
6. The scripts and library files supplied as input to or produced as
|
||||
output from the programs of this Package do not automatically fall
|
||||
under the copyright of this Package, but belong to whoever generated
|
||||
them, and may be sold commercially, and may be aggregated with this
|
||||
Package. If such scripts or library files are aggregated with this
|
||||
Package via the so-called "undump" or "unexec" methods of producing a
|
||||
binary executable image, then distribution of such an image shall
|
||||
neither be construed as a distribution of this Package nor shall it
|
||||
fall under the restrictions of Paragraphs 3 and 4, provided that you do
|
||||
not represent such an executable image as a Standard Version of this
|
||||
Package.
|
||||
|
||||
7. C subroutines (or comparably compiled subroutines in other
|
||||
languages) supplied by you and linked into this Package in order to
|
||||
emulate subroutines and variables of the language defined by this
|
||||
Package shall not be considered part of this Package, but are the
|
||||
equivalent of input as in Paragraph 6, provided these subroutines do
|
||||
not change the language in any way that would cause it to fail the
|
||||
regression tests for the language.
|
||||
|
||||
8. Aggregation of this Package with a commercial distribution is always
|
||||
permitted provided that the use of this Package is embedded; that is,
|
||||
when no overt attempt is made to make this Package's interfaces visible
|
||||
to the end user of the commercial distribution. Such use shall not be
|
||||
construed as a distribution of this Package.
|
||||
|
||||
9. The name of the Copyright Holder may not be used to endorse or promote
|
||||
products derived from this software without specific prior written permission.
|
||||
|
||||
10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
The End
|
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
// Copyright 2014 PDFium Authors. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -1,17 +0,0 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<title>The quick brown fox jumps over the lazy dog</title>
|
||||
<meta name="author" content="Nevin Nollop">
|
||||
<meta name="keywords" content="Pangram, fox, dog">
|
||||
<meta name="description" content="Gym class featuring a brown fox and lazy dog">
|
||||
</head>
|
||||
|
||||
<body lang=EN-US>
|
||||
|
||||
The quick brown fox jumps over the lazy dog
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -30,5 +30,4 @@ import org.alfresco.transform.imagemagick.ImageMagickTransformationIT;
|
||||
|
||||
public class AIOImageMagickIT extends ImageMagickTransformationIT
|
||||
{
|
||||
// Tests are in ImageMagickTransformationIT
|
||||
}
|
||||
|
@@ -28,12 +28,6 @@ package org.alfresco.transform.aio;
|
||||
|
||||
import org.alfresco.transform.misc.MiscMetadataExtractsIT;
|
||||
|
||||
/**
|
||||
* Metadata integration tests in the Misc T-Engine, but run from the AIO T-Engine.
|
||||
*
|
||||
* @author adavis
|
||||
* @author dedwards
|
||||
*/
|
||||
public class AIOMiscMetadataExtractsIT extends MiscMetadataExtractsIT
|
||||
{
|
||||
}
|
||||
|
@@ -28,12 +28,6 @@ package org.alfresco.transform.aio;
|
||||
|
||||
import org.alfresco.transform.tika.TikaMetadataExtractsIT;
|
||||
|
||||
/**
|
||||
* Metadata integration tests in the Tika T-Engine, but run from the AIO T-Engine.
|
||||
*
|
||||
* @author adavis
|
||||
* @author dedwards
|
||||
*/
|
||||
public class AIOTikaMetadataExtractsIT extends TikaMetadataExtractsIT
|
||||
{
|
||||
}
|
||||
|
@@ -1,312 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Transform Core
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 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.transform.aio;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.alfresco.transform.config.TransformConfig;
|
||||
import org.alfresco.transform.registry.AbstractTransformRegistry;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.text.PDFTextStripper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.alfresco.transform.common.RequestParamMap.PAGE_LIMIT;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class AIOTransformRegistryTest
|
||||
{
|
||||
private static final String SOURCE_MIMETYPE = "text/html";
|
||||
private static final String TARGET_MIMETYPE = "text/plain";
|
||||
String SOURCE_ENCODING = "sourceEncoding";
|
||||
|
||||
@Autowired AbstractTransformRegistry transformRegistry;
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
|
||||
private void writeToFile(File file, String content, String encoding) throws Exception
|
||||
{
|
||||
try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
|
||||
{
|
||||
ow.append(content);
|
||||
}
|
||||
}
|
||||
|
||||
private String readFromFile(File file, final String encoding) throws Exception
|
||||
{
|
||||
return new String(Files.readAllBytes(file.toPath()), encoding);
|
||||
}
|
||||
|
||||
private TransformConfig loadConfig(String s) throws Exception
|
||||
{
|
||||
return objectMapper.readValue(new ClassPathResource(s).getFile(), TransformConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigAggregation() throws Exception
|
||||
{
|
||||
// List<String> expectedTransformNames = Arrays.asList("html", "string", "appleIWorks", "textToPdf", "rfc822",
|
||||
// "Archive", "OutlookMsg", "PdfBox", "Office", "Poi", "OOXML", "TikaAuto", "TextMining");
|
||||
//
|
||||
// List<String> expectedTransformOptionNames = Arrays.asList("tikaOptions", "archiveOptions", "pdfboxOptions",
|
||||
// "textToPdfOptions", "stringOptions", "metadataOptions");
|
||||
//
|
||||
// TransformConfig miscConfig = loadConfig("misc_engine_config.json");
|
||||
// TransformConfig tikaConfig = loadConfig("tika_engine_config.json");
|
||||
//
|
||||
// // check correct number of transformers
|
||||
// assertEquals(
|
||||
// miscConfig.getTransformers().size() + tikaConfig.getTransformers().size(),
|
||||
// transformRegistry.getTransformConfig().getTransformers().size(),
|
||||
// "Number of expected transformers");
|
||||
//
|
||||
// List<String> actualTransformerNames = transformRegistry.getTransformConfig().getTransformers()
|
||||
// .stream().map(t -> t.getTransformerName()).collect(Collectors.toList());
|
||||
// // check all transformers are there
|
||||
// for(String transformNames : expectedTransformNames)
|
||||
// {
|
||||
// assertTrue(actualTransformerNames.contains(transformNames),"Expected transformer missing.");
|
||||
// }
|
||||
//
|
||||
// // check correct number of options
|
||||
// long distinctOptionCount = Stream.concat(
|
||||
// miscConfig.getTransformOptions().keySet().stream(),
|
||||
// tikaConfig.getTransformOptions().keySet().stream()).distinct().count();
|
||||
// assertEquals(
|
||||
// distinctOptionCount,
|
||||
// transformRegistry.getTransformConfig().getTransformOptions().size(),
|
||||
// "Number of expected transformers");
|
||||
//
|
||||
// Set<String> actualOptionNames = transformRegistry.getTransformConfig().getTransformOptions().keySet();
|
||||
//
|
||||
// // check all options are there
|
||||
// for (String optionName : expectedTransformOptionNames)
|
||||
// {
|
||||
// assertTrue(actualOptionNames.contains(optionName), "Expected transform option missing:"+optionName);
|
||||
// }
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransformerMapping()
|
||||
{
|
||||
// List<String> tikaTransforms = Arrays.asList("Archive", "OutlookMsg", "PdfBox", "Office", "Poi", "OOXML", "TikaAuto", "TextMining");
|
||||
// List<String> miscTransforms = Arrays.asList("html", "string", "appleIWorks", "textToPdf", "rfc822");
|
||||
//
|
||||
// for (String transform : tikaTransforms)
|
||||
// {
|
||||
// String actualId = transformRegistry.getByTransformName(transform).getTransformerId();
|
||||
// assertEquals("tika", actualId, "Wrong mapping for transform "+transform);
|
||||
// }
|
||||
//
|
||||
// for (String transform : miscTransforms)
|
||||
// {
|
||||
// String actualId = transformRegistry.getByTransformName(transform).getTransformerId();
|
||||
// assertEquals("misc", actualId, "Wrong mapping for transform "+transform);
|
||||
// }
|
||||
}
|
||||
|
||||
// Test copied from Misc (HtmlParserContentTransformerTest) See ATS-712 aioTransformerRegistry - html
|
||||
@Test
|
||||
public void testMiscHtml() throws Exception
|
||||
{
|
||||
// final String NEWLINE = System.getProperty("line.separator");
|
||||
// final String TITLE = "Testing!";
|
||||
// final String TEXT_P1 = "This is some text in English";
|
||||
// final String TEXT_P2 = "This is more text in English";
|
||||
// final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
|
||||
// String partA = "<html><head><title>" + TITLE + "</title></head>" + NEWLINE;
|
||||
// String partB = "<body><p>" + TEXT_P1 + "</p>" + NEWLINE +
|
||||
// "<p>" + TEXT_P2 + "</p>" + NEWLINE +
|
||||
// "<p>" + TEXT_P3 + "</p>" + NEWLINE;
|
||||
// String partC = "</body></html>";
|
||||
// final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
|
||||
//
|
||||
// File tmpS = null;
|
||||
// File tmpD = null;
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// // Content set to ISO 8859-1
|
||||
// tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||
// writeToFile(tmpS, partA + partB + partC, "ISO-8859-1");
|
||||
//
|
||||
// tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||
//
|
||||
// Map<String, String> parameters = new HashMap<>();
|
||||
// parameters.put(SOURCE_ENCODING, "ISO-8859-1");
|
||||
// Transformer transformer = transformRegistry.getByTransformName("html");
|
||||
// transformer.transformExtractOrEmbed("html", SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters, tmpS, tmpD);
|
||||
//
|
||||
// assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||
// tmpS.delete();
|
||||
// tmpD.delete();
|
||||
//
|
||||
// // Content set to UTF-8
|
||||
// tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||
// writeToFile(tmpS, partA + partB + partC, "UTF-8");
|
||||
//
|
||||
// tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||
// parameters = new HashMap<>();
|
||||
// parameters.put(SOURCE_ENCODING, "UTF-8");
|
||||
// transformer.transformExtractOrEmbed("html", SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters, tmpS, tmpD);
|
||||
// assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||
// tmpS.delete();
|
||||
// tmpD.delete();
|
||||
//
|
||||
// // Content set to UTF-16
|
||||
// tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||
// writeToFile(tmpS, partA + partB + partC, "UTF-16");
|
||||
//
|
||||
// tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||
// parameters = new HashMap<>();
|
||||
// parameters.put(SOURCE_ENCODING, "UTF-16");
|
||||
// transformer.transformExtractOrEmbed("html", SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters, tmpS, tmpD);
|
||||
// assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||
// tmpS.delete();
|
||||
// tmpD.delete();
|
||||
//
|
||||
// // Note - since HTML Parser 2.0 META tags specifying the
|
||||
// // document encoding will ONLY be respected if the original
|
||||
// // content type was set to ISO-8859-1.
|
||||
// //
|
||||
// // This means there is now only one test which we can perform
|
||||
// // to ensure that this now-limited overriding of the encoding
|
||||
// // takes effect.
|
||||
//
|
||||
// // Content set to ISO 8859-1, meta set to UTF-8
|
||||
// tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||
// String str = partA +
|
||||
// "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
|
||||
// partB + partC;
|
||||
//
|
||||
// writeToFile(tmpS, str, "UTF-8");
|
||||
//
|
||||
// tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||
//
|
||||
// parameters = new HashMap<>();
|
||||
// parameters.put(SOURCE_ENCODING, "ISO-8859-1");
|
||||
// transformer.transformExtractOrEmbed("html", SOURCE_MIMETYPE, TARGET_MIMETYPE, parameters, tmpS, tmpD);
|
||||
// assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||
// tmpS.delete();
|
||||
// tmpD.delete();
|
||||
//
|
||||
// // Note - we can't test UTF-16 with only a meta encoding,
|
||||
// // because without that the parser won't know about the
|
||||
// // 2 byte format so won't be able to identify the meta tag
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// if (tmpS != null && tmpS.exists()) tmpS.delete();
|
||||
// if (tmpD != null && tmpD.exists()) tmpD.delete();
|
||||
// }
|
||||
}
|
||||
|
||||
// Test copied from Misc (TextToPdfContentTransformerTest) See ATS-712 aioTransformerRegistry - pdf
|
||||
@Test
|
||||
public void testMiscPdf() throws Exception
|
||||
{
|
||||
transformTextAndCheckPageLength(-1);
|
||||
}
|
||||
|
||||
private void transformTextAndCheckPageLength(int pageLimit) throws Exception
|
||||
{
|
||||
int pageLength = 32;
|
||||
int lines = (pageLength + 10) * ((pageLimit > 0) ? pageLimit : 1);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String checkText = null;
|
||||
int cutoff = pageLimit * pageLength;
|
||||
for (int i = 1; i <= lines; i++)
|
||||
{
|
||||
sb.append(Integer.toString(i));
|
||||
sb.append(" I must not talk in class or feed my homework to my cat.\n");
|
||||
if (i == cutoff)
|
||||
checkText = sb.toString();
|
||||
}
|
||||
sb.append("\nBart\n");
|
||||
String text = sb.toString();
|
||||
checkText = (checkText == null) ? clean(text) : clean(checkText);
|
||||
transformTextAndCheck(text, "UTF-8", checkText, String.valueOf(pageLimit));
|
||||
}
|
||||
|
||||
private void transformTextAndCheck(String text, String encoding, String checkText,
|
||||
String pageLimit) throws Exception
|
||||
{
|
||||
// // Get a reader for the text
|
||||
// File sourceFile = File.createTempFile("AlfrescoTestSource_", ".txt");
|
||||
// writeToFile(sourceFile, text, encoding);
|
||||
//
|
||||
// // And a temp writer
|
||||
// File targetFile = File.createTempFile("AlfrescoTestTarget_", ".pdf");
|
||||
//
|
||||
// // Transform to PDF
|
||||
// Map<String, String> parameters = new HashMap<>();
|
||||
// parameters.put(PAGE_LIMIT, pageLimit);
|
||||
// Transformer transformer = transformRegistry.getByTransformName("textToPdf");
|
||||
// transformer.transformExtractOrEmbed("textToPdf", "text/plain", "application/pdf", parameters, sourceFile, targetFile);
|
||||
//
|
||||
// // Read back in the PDF and check it
|
||||
// PDDocument doc = PDDocument.load(targetFile);
|
||||
// PDFTextStripper textStripper = new PDFTextStripper();
|
||||
// StringWriter textWriter = new StringWriter();
|
||||
// textStripper.writeText(doc, textWriter);
|
||||
// doc.close();
|
||||
//
|
||||
// String roundTrip = clean(textWriter.toString());
|
||||
//
|
||||
// assertEquals(
|
||||
// checkText, roundTrip,
|
||||
// "Incorrect text in PDF when starting from text in " + encoding
|
||||
// );
|
||||
//
|
||||
// sourceFile.delete();
|
||||
// targetFile.delete();
|
||||
}
|
||||
|
||||
private String clean(String text)
|
||||
{
|
||||
text = text.replaceAll("\\s+\\r", "");
|
||||
text = text.replaceAll("\\s+\\n", "");
|
||||
text = text.replaceAll("\\r", "");
|
||||
text = text.replaceAll("\\n", "");
|
||||
return text;
|
||||
}
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
{
|
||||
"transformOptions": {
|
||||
"textToPdfOptions": [
|
||||
{"value": {"name": "pageLimit"}}
|
||||
],
|
||||
"stringOptions": [
|
||||
{"value": {"name": "targetEncoding"}}
|
||||
],
|
||||
"metadataOptions": [
|
||||
{"value": {"name": "extractMapping"}}
|
||||
]
|
||||
},
|
||||
"transformers": [
|
||||
{
|
||||
"transformerName": "html",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"}
|
||||
],
|
||||
"transformOptions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "string",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "text/plain", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/richtext", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/sgml", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-setext", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-jsp", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-markdown", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/calendar", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/x-javascript", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/dita+xml", "targetMediaType": "text/plain"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"stringOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "appleIWorks",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "image/jpeg"},
|
||||
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "image/jpeg"},
|
||||
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "image/jpeg"}
|
||||
],
|
||||
"transformOptions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "textToPdf",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"textToPdfOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "rfc822",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "message/rfc822", "targetMediaType": "text/plain"}
|
||||
],
|
||||
"transformOptions": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "HtmlMetadataExtractor",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "alfresco-metadata-extract"},
|
||||
{"sourceMediaType": "application/xhtml+xml", "targetMediaType": "alfresco-metadata-extract"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"metadataOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "RFC822MetadataExtractor",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "message/rfc822", "targetMediaType": "alfresco-metadata-extract"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"metadataOptions"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@@ -512,7 +512,7 @@ public class TransformHandler
|
||||
sourceSizeInBytes, targetMimetype, transformOptions, null);
|
||||
if (transformerName == null)
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST, "No transforms were able to handle the request: "+
|
||||
throw new TransformException(BAD_REQUEST, "No transforms for: "+
|
||||
sourceMimetype+" -> "+targetMimetype+transformOptions.entrySet().stream()
|
||||
.map(entry -> entry.getKey()+"="+entry.getValue())
|
||||
.collect(Collectors.joining(", ", " ", "")));
|
||||
|
@@ -358,7 +358,15 @@ public class ProbeTransform
|
||||
|
||||
public void resetForTesting()
|
||||
{
|
||||
die.set(false);
|
||||
probeCount = 0;
|
||||
transCount = 0;
|
||||
normalTime = 0;
|
||||
maxTime = Long.MAX_VALUE;
|
||||
nextTransformTime = 0;
|
||||
|
||||
initialised.set(false);
|
||||
readySent.set(false);
|
||||
transformCount.set(0);
|
||||
die.set(false);
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
/**
|
||||
* Super class for testing.
|
||||
* Super class for unit testing.
|
||||
*/
|
||||
@SpringBootTest(classes={org.alfresco.transform.base.Application.class})
|
||||
@AutoConfigureMockMvc
|
||||
@@ -327,6 +327,7 @@ public abstract class AbstractBaseTest
|
||||
public void calculateMaxTime() throws Exception
|
||||
{
|
||||
ProbeTransform probeTransform = controller.probeTransform;
|
||||
probeTransform.resetForTesting();
|
||||
probeTransform.setLivenessPercent(110);
|
||||
|
||||
long[][] values = new long[][]{
|
||||
|
@@ -410,6 +410,6 @@ public class TransformControllerTest
|
||||
.param("unknown", "1"))
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(content().string(containsString("TwoCustomTransformers Error Page")))
|
||||
.andExpect(content().string(containsString("No transforms were able to handle the request")));
|
||||
.andExpect(content().string(containsString("No transforms for:")));
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${IMAGEUSERNAME} && \
|
||||
|
@@ -30,7 +30,7 @@ RUN ln /${env.project_artifactId}-${env.project_version}.jar /usr/bin/${env.proj
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${LIBREUSERNAME} && \
|
||||
|
@@ -18,7 +18,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${MISCUSERNAME} && \
|
||||
|
@@ -24,7 +24,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${PDFUSERNAME} && \
|
||||
|
@@ -33,7 +33,7 @@ RUN ln /usr/bin/${env.project_artifactId}-${env.project_version}.jar /usr/bin/${
|
||||
ADD target/generated-resources/licenses /licenses
|
||||
ADD target/generated-resources/licenses.xml /licenses/
|
||||
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||
COPY src/main/resources/licenses/3rd-party/ /
|
||||
COPY target/classes/licenses/3rd-party/ /
|
||||
|
||||
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||
useradd -u ${USERID} -G ${GROUPNAME} ${TIKAUSERNAME} && \
|
||||
|
Reference in New Issue
Block a user