├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── build.gradle ├── dev-tools ├── email_template.html ├── email_template.txt ├── release.py ├── tests.policy └── upload-s3.py ├── licenses ├── bcmail-jdk15on-1.52.jar.sha1 ├── bcmail-jdk15on-LICENSE.txt ├── bcmail-jdk15on-NOTICE.txt ├── bcpkix-jdk15on-1.52.jar.sha1 ├── bcpkix-jdk15on-LICENSE.txt ├── bcpkix-jdk15on-NOTICE.txt ├── bcprov-jdk15on-1.52.jar.sha1 ├── bcprov-jdk15on-LICENSE.txt ├── bcprov-jdk15on-NOTICE.txt ├── commons-codec-1.9.jar.sha1 ├── commons-codec-LICENSE.txt ├── commons-codec-NOTICE.txt ├── commons-compress-1.10.jar.sha1 ├── commons-compress-LICENSE.txt ├── commons-compress-NOTICE.txt ├── commons-io-2.4.jar.sha1 ├── commons-io-LICENSE.txt ├── commons-io-NOTICE.txt ├── commons-logging-1.1.1.jar.sha1 ├── commons-logging-LICENSE.txt ├── commons-logging-NOTICE.txt ├── fontbox-1.8.10.jar.sha1 ├── fontbox-LICENSE.txt ├── fontbox-NOTICE.txt ├── jempbox-1.8.10.jar.sha1 ├── jempbox-LICENSE.txt ├── jempbox-NOTICE.txt ├── juniversalchardet-1.0.3.jar.sha1 ├── juniversalchardet-LICENSE.txt ├── juniversalchardet-NOTICE.txt ├── pdfbox-1.8.10.jar.sha1 ├── pdfbox-LICENSE.txt ├── pdfbox-NOTICE.txt ├── poi-3.13.jar.sha1 ├── poi-LICENSE.txt ├── poi-NOTICE.txt ├── poi-ooxml-3.13.jar.sha1 ├── poi-ooxml-LICENSE.txt ├── poi-ooxml-NOTICE.txt ├── poi-ooxml-schemas-3.13.jar.sha1 ├── poi-ooxml-schemas-LICENSE.txt ├── poi-ooxml-schemas-NOTICE.txt ├── poi-scratchpad-3.13.jar.sha1 ├── poi-scratchpad-LICENSE.txt ├── poi-scratchpad-NOTICE.txt ├── stax-api-1.0.1.jar.sha1 ├── stax-api-LICENSE.txt ├── stax-api-NOTICE.txt ├── tagsoup-1.2.1.jar.sha1 ├── tagsoup-LICENSE.txt ├── tagsoup-NOTICE.txt ├── tika-core-1.11.jar.sha1 ├── tika-core-LICENSE.txt ├── tika-core-NOTICE.txt ├── tika-parsers-1.11.jar.sha1 ├── tika-parsers-LICENSE.txt ├── tika-parsers-NOTICE.txt ├── xmlbeans-2.6.0.jar.sha1 ├── xmlbeans-LICENSE.txt └── xmlbeans-NOTICE.txt └── src ├── main ├── java │ └── org │ │ └── elasticsearch │ │ └── mapper │ │ └── attachments │ │ ├── AttachmentMapper.java │ │ ├── MapperAttachmentsPlugin.java │ │ └── TikaImpl.java └── plugin-metadata │ └── plugin-security.policy └── test ├── java └── org │ └── elasticsearch │ └── mapper │ └── attachments │ ├── AttachmentUnitTestCase.java │ ├── DateAttachmentMapperTests.java │ ├── EncryptedDocMapperTests.java │ ├── LanguageDetectionAttachmentMapperTests.java │ ├── MapperAttachmentsRestIT.java │ ├── MapperTestUtils.java │ ├── MetadataMapperTests.java │ ├── MultifieldAttachmentMapperTests.java │ ├── SimpleAttachmentMapperTests.java │ ├── StandaloneRunner.java │ ├── TikaDocTests.java │ ├── TikaImplTests.java │ └── VariousDocTests.java └── resources ├── org └── elasticsearch │ └── index │ └── mapper │ └── attachment │ └── test │ ├── sample-files │ ├── asciidoc.asciidoc │ ├── encrypted.pdf │ ├── htmlWithEmptyDateMeta.html │ ├── htmlWithValidDateMeta.html │ ├── htmlWithoutDateMeta.html │ ├── issue-104.docx │ ├── testContentLength.txt │ ├── testXHTML.html │ ├── text-in-english.txt │ ├── text-in-french.txt │ └── text-in-nolang.txt │ ├── standalone │ └── standalone-mapping.json │ ├── tika-files.zip │ └── unit │ ├── date │ └── date-mapping.json │ ├── encrypted │ └── test-mapping.json │ ├── language │ └── language-mapping.json │ ├── metadata │ └── test-mapping.json │ ├── multifield │ └── multifield-mapping.json │ ├── simple │ ├── test-mapping-all-fields.json │ └── test-mapping.json │ └── various-doc │ └── test-mapping.json └── rest-api-spec └── test └── mapper_attachments ├── 00_basic.yaml ├── 10_index.yaml ├── 20_search.yaml ├── 30_mapping.yaml └── 40_highlight.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | /data 2 | /work 3 | /logs 4 | /.idea 5 | /target 6 | .DS_Store 7 | *.iml 8 | /.project 9 | /.settings 10 | /.classpath 11 | /plugin_tools 12 | /.local-execution-hints.log 13 | /.local-*-execution-hints.log 14 | /eclipse-build/ 15 | build/ 16 | **/.local* 17 | generated-resources/ 18 | .gradle/ 19 | /bin/ 20 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to elasticsearch 2 | ============================= 3 | 4 | Elasticsearch is an open source project and we love to receive contributions from our community — you! There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into Elasticsearch itself. 5 | 6 | Bug reports 7 | ----------- 8 | 9 | If you think you have found a bug in Elasticsearch, first make sure that you are testing against the [latest version of Elasticsearch](http://www.elasticsearch.org/download/) - your issue may already have been fixed. If not, search our [issues list](https://github.com/elasticsearch/elasticsearch/issues) on GitHub in case a similar issue has already been opened. 10 | 11 | It is very helpful if you can prepare a reproduction of the bug. In other words, provide a small test case which we can run to confirm your bug. It makes it easier to find the problem and to fix it. Test cases should be provided as `curl` commands which we can copy and paste into a terminal to run it locally, for example: 12 | 13 | ```sh 14 | # delete the index 15 | curl -XDELETE localhost:9200/test 16 | 17 | # insert a document 18 | curl -XPUT localhost:9200/test/test/1 -d '{ 19 | "title": "test document" 20 | }' 21 | 22 | # this should return XXXX but instead returns YYY 23 | curl .... 24 | ``` 25 | 26 | Provide as much information as you can. You may think that the problem lies with your query, when actually it depends on how your data is indexed. The easier it is for us to recreate your problem, the faster it is likely to be fixed. 27 | 28 | Feature requests 29 | ---------------- 30 | 31 | If you find yourself wishing for a feature that doesn't exist in Elasticsearch, you are probably not alone. There are bound to be others out there with similar needs. Many of the features that Elasticsearch has today have been added because our users saw the need. 32 | Open an issue on our [issues list](https://github.com/elasticsearch/elasticsearch/issues) on GitHub which describes the feature you would like to see, why you need it, and how it should work. 33 | 34 | Contributing code and documentation changes 35 | ------------------------------------------- 36 | 37 | If you have a bugfix or new feature that you would like to contribute to Elasticsearch, please find or open an issue about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there are particular issues that you should know about before implementing the change. 38 | 39 | We enjoy working with contributors to get their code accepted. There are many approaches to fixing a problem and it is important to find the best approach before writing too much code. 40 | 41 | The process for contributing to any of the [Elasticsearch repositories](https://github.com/elasticsearch/) is similar. Details for individual projects can be found below. 42 | 43 | ### Fork and clone the repository 44 | 45 | You will need to fork the main Elasticsearch code or documentation repository and clone it to your local machine. See 46 | [github help page](https://help.github.com/articles/fork-a-repo) for help. 47 | 48 | Further instructions for specific projects are given below. 49 | 50 | ### Submitting your changes 51 | 52 | Once your changes and tests are ready to submit for review: 53 | 54 | 1. Test your changes 55 | Run the test suite to make sure that nothing is broken. 56 | 57 | 2. Sign the Contributor License Agreement 58 | Please make sure you have signed our [Contributor License Agreement](http://www.elasticsearch.org/contributor-agreement/). We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once. 59 | 60 | 3. Rebase your changes 61 | Update your local repository with the most recent code from the main Elasticsearch repository, and rebase your branch on top of the latest master branch. We prefer your changes to be squashed into a single commit. 62 | 63 | 4. Submit a pull request 64 | Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/using-pull-requests). In the pull request, describe what your changes do and mention the number of the issue where discussion has taken place, eg "Closes #123". 65 | 66 | Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into Elasticsearch. 67 | 68 | 69 | Contributing to the Elasticsearch plugin 70 | ---------------------------------------- 71 | 72 | **Repository:** [https://github.com/elasticsearch/elasticsearch-mapper-attachments](https://github.com/elasticsearch/elasticsearch-mapper-attachments) 73 | 74 | Make sure you have [Maven](http://maven.apache.org) installed, as Elasticsearch uses it as its build system. Integration with IntelliJ and Eclipse should work out of the box. Eclipse users can automatically configure their IDE by running `mvn eclipse:eclipse` and then importing the project into their workspace: `File > Import > Existing project into workspace`. 75 | 76 | Please follow these formatting guidelines: 77 | 78 | * Java indent is 4 spaces 79 | * Line width is 140 characters 80 | * The rest is left to Java coding standards 81 | * Disable “auto-format on save” to prevent unnecessary format changes. This makes reviews much harder as it generates unnecessary formatting changes. If your IDE supports formatting only modified chunks that is fine to do. 82 | 83 | To create a distribution from the source, simply run: 84 | 85 | ```sh 86 | cd elasticsearch-mapper-attachments/ 87 | mvn clean package -DskipTests 88 | ``` 89 | 90 | You will find the newly built packages under: `./target/releases/`. 91 | 92 | Before submitting your changes, run the test suite to make sure that nothing is broken, with: 93 | 94 | ```sh 95 | mvn clean test 96 | ``` 97 | 98 | Source: [Contributing to elasticsearch](http://www.elasticsearch.org/contributing-to-elasticsearch/) 99 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | import org.elasticsearch.gradle.ElasticsearchProperties 21 | import org.elasticsearch.gradle.precommit.DependencyLicensesTask 22 | 23 | buildscript { 24 | repositories { 25 | mavenCentral() 26 | maven { 27 | name 'sonatype-snapshots' 28 | url 'https://oss.sonatype.org/content/repositories/snapshots/' 29 | } 30 | jcenter() 31 | } 32 | dependencies { 33 | classpath 'org.elasticsearch.gradle:build-tools:3.0.0-SNAPSHOT' 34 | } 35 | } 36 | apply plugin: 'idea' 37 | apply plugin: 'eclipse' 38 | apply plugin: 'elasticsearch.esplugin' 39 | 40 | esplugin { 41 | name 'mapper-attachments' 42 | description 'The mapper attachments plugin adds the attachment type to Elasticsearch using Apache Tika.' 43 | classname 'org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin' 44 | } 45 | 46 | group = 'org.elasticsearch.plugin' 47 | version = ElasticsearchProperties.version 48 | ext.luceneVersion = ElasticsearchProperties.luceneVersion 49 | repositories { 50 | mavenCentral() 51 | maven { 52 | name 'sonatype-snapshots' 53 | url 'https://oss.sonatype.org/content/repositories/snapshots/' 54 | } 55 | if (luceneVersion.contains('-snapshot')) { 56 | String revision = (luceneVersion =~ /\d\.\d\.\d-snapshot-(\d+)/)[0][1] 57 | maven { 58 | name 'lucene-snapshots' 59 | url "https://s3.amazonaws.com/download.elasticsearch.org/lucenesnapshots/${revision}" 60 | } 61 | } 62 | } 63 | 64 | dependencies { 65 | // mandatory for tika 66 | compile('org.apache.tika:tika-core:1.11') 67 | compile('org.apache.tika:tika-parsers:1.11') { 68 | transitive = false 69 | } 70 | compile('commons-io:commons-io:2.4') 71 | 72 | // character set detection 73 | compile('com.googlecode.juniversalchardet:juniversalchardet:1.0.3') 74 | 75 | // external parser libraries 76 | // HTML 77 | compile('org.ccil.cowan.tagsoup:tagsoup:1.2.1') 78 | // Adobe PDF 79 | compile('org.apache.pdfbox:pdfbox:1.8.10') 80 | compile('org.bouncycastle:bcmail-jdk15on:1.52') 81 | // OpenOffice 82 | compile('org.apache.poi:poi-ooxml:3.13') 83 | // MS Office 84 | compile('org.apache.poi:poi-scratchpad:3.13') 85 | // Apple iWork 86 | compile('org.apache.commons:commons-compress:1.10') 87 | } 88 | 89 | compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes' 90 | 91 | forbiddenPatterns { 92 | exclude '**/*.docx' 93 | exclude '**/*.pdf' 94 | } 95 | 96 | // fix ES build so this is not needed 97 | Task dependencyLicensesTask = DependencyLicensesTask.configure(project) { 98 | dependencies = project.configurations.runtime - project.configurations.provided 99 | } 100 | project.precommit.dependsOn(dependencyLicensesTask) 101 | -------------------------------------------------------------------------------- /dev-tools/email_template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Heya,

4 | 5 |

We are pleased to announce the release of the %(artifact_name)s, version %(release_version)s

6 | 7 |
%(artifact_description)s.
8 | 9 |

Release Notes - Version %(release_version)s

10 | %(empty_message)s 11 | %(issues_bug)s 12 | %(issues_update)s 13 | %(issues_new)s 14 | %(issues_doc)s 15 | 16 |

For questions or comments around this plugin, feel free to use elasticsearch 17 | mailing list!

18 | 19 |

Enjoy,

20 |

- The Elastic team

21 | 22 | 23 | -------------------------------------------------------------------------------- /dev-tools/email_template.txt: -------------------------------------------------------------------------------- 1 | Heya, 2 | 3 | 4 | We are pleased to announce the release of the %(artifact_name)s, version %(release_version)s. 5 | 6 | %(artifact_description)s. 7 | 8 | %(project_url)s 9 | 10 | Release Notes - %(artifact_id)s - Version %(release_version)s 11 | 12 | %(empty_message)s 13 | %(issues_bug)s 14 | %(issues_update)s 15 | %(issues_new)s 16 | %(issues_doc)s 17 | 18 | For questions or comments around this plugin, feel free to use elasticsearch mailing list: https://discuss.elastic.co/c/elasticsearch 19 | 20 | Enjoy, 21 | 22 | -The Elasticsearch team 23 | -------------------------------------------------------------------------------- /dev-tools/tests.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | // Policy file to prevent tests from writing outside the test sandbox directory 21 | // PLEASE NOTE: You may need to enable other permissions when new tests are added, 22 | // everything not allowed here is forbidden! 23 | 24 | grant { 25 | // permissions for file access, write access only to sandbox: 26 | permission java.io.FilePermission "<>", "read,execute"; 27 | permission java.io.FilePermission "${junit4.childvm.cwd}", "read,execute,write"; 28 | permission java.io.FilePermission "${junit4.childvm.cwd}${/}-", "read,execute,write,delete"; 29 | permission java.io.FilePermission "${junit4.tempDir}${/}*", "read,execute,write,delete"; 30 | permission groovy.security.GroovyCodeSourcePermission "/groovy/script"; 31 | 32 | // Allow connecting to the internet anywhere 33 | permission java.net.SocketPermission "*", "accept,listen,connect,resolve"; 34 | 35 | // Basic permissions needed for Lucene / Elasticsearch to work: 36 | permission java.util.PropertyPermission "*", "read,write"; 37 | permission java.lang.reflect.ReflectPermission "*"; 38 | permission java.lang.RuntimePermission "*"; 39 | 40 | // These two *have* to be spelled out a separate 41 | permission java.lang.management.ManagementPermission "control"; 42 | permission java.lang.management.ManagementPermission "monitor"; 43 | 44 | permission java.net.NetPermission "*"; 45 | permission java.util.logging.LoggingPermission "control"; 46 | permission javax.management.MBeanPermission "*", "*"; 47 | permission javax.management.MBeanServerPermission "*"; 48 | permission javax.management.MBeanTrustPermission "*"; 49 | 50 | // Needed for some things in DNS caching in the JVM 51 | permission java.security.SecurityPermission "getProperty.networkaddress.cache.ttl"; 52 | permission java.security.SecurityPermission "getProperty.networkaddress.cache.negative.ttl"; 53 | 54 | }; 55 | -------------------------------------------------------------------------------- /dev-tools/upload-s3.py: -------------------------------------------------------------------------------- 1 | # Licensed to Elasticsearch under one or more contributor 2 | # license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright 4 | # ownership. Elasticsearch licenses this file to you under 5 | # the Apache License, Version 2.0 (the "License"); you may 6 | # not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on 13 | # an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 14 | # either express or implied. See the License for the specific 15 | # language governing permissions and limitations under the License. 16 | 17 | import os 18 | import sys 19 | import argparse 20 | try: 21 | import boto.s3 22 | except: 23 | raise RuntimeError(""" 24 | S3 upload requires boto to be installed 25 | Use one of: 26 | 'pip install -U boto' 27 | 'apt-get install python-boto' 28 | 'easy_install boto' 29 | """) 30 | 31 | 32 | def list_buckets(conn): 33 | return conn.get_all_buckets() 34 | 35 | 36 | def upload_s3(conn, path, key, file, bucket): 37 | print('Uploading %s to Amazon S3 bucket %s/%s') % \ 38 | (file, bucket, os.path.join(path, key)) 39 | def percent_cb(complete, total): 40 | sys.stdout.write('.') 41 | sys.stdout.flush() 42 | bucket = conn.create_bucket(bucket) 43 | k = bucket.new_key(os.path.join(path, key)) 44 | k.set_contents_from_filename(file, cb=percent_cb, num_cb=100) 45 | 46 | 47 | if __name__ == '__main__': 48 | parser = argparse.ArgumentParser(description='Uploads files to Amazon S3') 49 | parser.add_argument('--file', '-f', metavar='path to file', 50 | help='the branch to release from', required=True) 51 | parser.add_argument('--bucket', '-b', metavar='B42', default='download.elasticsearch.org', 52 | help='The S3 Bucket to upload to') 53 | parser.add_argument('--path', '-p', metavar='elasticsearch/elasticsearch', default='elasticsearch/elasticsearch', 54 | help='The key path to use') 55 | parser.add_argument('--key', '-k', metavar='key', default=None, 56 | help='The key - uses the file name as default key') 57 | args = parser.parse_args() 58 | if args.key: 59 | key = args.key 60 | else: 61 | key = os.path.basename(args.file) 62 | 63 | connection = boto.connect_s3() 64 | upload_s3(connection, args.path, key, args.file, args.bucket); 65 | 66 | -------------------------------------------------------------------------------- /licenses/bcmail-jdk15on-1.52.jar.sha1: -------------------------------------------------------------------------------- 1 | 4995a870400e1554d1c7ed2afcb5d198fae12db9 2 | -------------------------------------------------------------------------------- /licenses/bcmail-jdk15on-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. 4 | (http://www.bouncycastle.org) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /licenses/bcmail-jdk15on-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/bcmail-jdk15on-NOTICE.txt -------------------------------------------------------------------------------- /licenses/bcpkix-jdk15on-1.52.jar.sha1: -------------------------------------------------------------------------------- 1 | b8ffac2bbc6626f86909589c8cc63637cc936504 2 | -------------------------------------------------------------------------------- /licenses/bcpkix-jdk15on-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. 4 | (http://www.bouncycastle.org) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /licenses/bcpkix-jdk15on-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/bcpkix-jdk15on-NOTICE.txt -------------------------------------------------------------------------------- /licenses/bcprov-jdk15on-1.52.jar.sha1: -------------------------------------------------------------------------------- 1 | 88a941faf9819d371e3174b5ed56a3f3f7d73269 2 | -------------------------------------------------------------------------------- /licenses/bcprov-jdk15on-LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2000 - 2013 The Legion of the Bouncy Castle Inc. 4 | (http://www.bouncycastle.org) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /licenses/bcprov-jdk15on-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/bcprov-jdk15on-NOTICE.txt -------------------------------------------------------------------------------- /licenses/commons-codec-1.9.jar.sha1: -------------------------------------------------------------------------------- 1 | 9ce04e34240f674bc72680f8b843b1457383161a 2 | -------------------------------------------------------------------------------- /licenses/commons-codec-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /licenses/commons-codec-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons CLI 2 | Copyright 2001-2009 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /licenses/commons-compress-1.10.jar.sha1: -------------------------------------------------------------------------------- 1 | 5eeb27c57eece1faf2d837868aeccc94d84dcc9a -------------------------------------------------------------------------------- /licenses/commons-compress-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /licenses/commons-compress-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons Compress 2 | Copyright 2002-2015 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | The files in the package org.apache.commons.compress.archivers.sevenz 8 | were derived from the LZMA SDK, version 9.20 (C/ and CPP/7zip/), 9 | which has been placed in the public domain: 10 | 11 | "LZMA SDK is placed in the public domain." (http://www.7-zip.org/sdk.html) 12 | -------------------------------------------------------------------------------- /licenses/commons-io-2.4.jar.sha1: -------------------------------------------------------------------------------- 1 | b1b6ea3b7e4aa4f492509a4952029cd8e48019ad 2 | -------------------------------------------------------------------------------- /licenses/commons-io-LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /licenses/commons-io-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons IO 2 | Copyright 2002-2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /licenses/commons-logging-1.1.1.jar.sha1: -------------------------------------------------------------------------------- 1 | 5043bfebc3db072ed80fbd362e7caf00e885d8ae -------------------------------------------------------------------------------- /licenses/commons-logging-LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /licenses/commons-logging-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Commons Logging 2 | Copyright 2003-2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /licenses/fontbox-1.8.10.jar.sha1: -------------------------------------------------------------------------------- 1 | 41776c7713e3f3a1ce688bd96459fc597298c340 2 | -------------------------------------------------------------------------------- /licenses/fontbox-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache PDFBox 2 | Copyright 2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Based on source code originally developed in the PDFBox and 8 | FontBox projects. 9 | 10 | Copyright (c) 2002-2007, www.pdfbox.org 11 | 12 | Based on source code originally developed in the PaDaF project. 13 | Copyright (c) 2010 Atos Worldline SAS 14 | 15 | Includes the Adobe Glyph List 16 | Copyright 1997, 1998, 2002, 2007, 2010 Adobe Systems Incorporated. 17 | 18 | Includes the Zapf Dingbats Glyph List 19 | Copyright 2002, 2010 Adobe Systems Incorporated. 20 | 21 | Includes OSXAdapter 22 | Copyright (C) 2003-2007 Apple, Inc., All Rights Reserved 23 | -------------------------------------------------------------------------------- /licenses/jempbox-1.8.10.jar.sha1: -------------------------------------------------------------------------------- 1 | 40df4e4ca884aadc20b82d5abd0a3679774c55a6 2 | -------------------------------------------------------------------------------- /licenses/jempbox-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006-2007, www.jempbox.org 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 3. Neither the name of fontbox; nor the names of its 13 | contributors may be used to endorse or promote products derived from this 14 | software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /licenses/jempbox-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/jempbox-NOTICE.txt -------------------------------------------------------------------------------- /licenses/juniversalchardet-1.0.3.jar.sha1: -------------------------------------------------------------------------------- 1 | cd49678784c46aa8789c060538e0154013bb421b 2 | -------------------------------------------------------------------------------- /licenses/juniversalchardet-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/juniversalchardet-NOTICE.txt -------------------------------------------------------------------------------- /licenses/pdfbox-1.8.10.jar.sha1: -------------------------------------------------------------------------------- 1 | bc5d1254495be36d0a3b3d6c35f88d05200b9311 2 | -------------------------------------------------------------------------------- /licenses/pdfbox-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache PDFBox 2 | Copyright 2014 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Based on source code originally developed in the PDFBox and 8 | FontBox projects. 9 | 10 | Copyright (c) 2002-2007, www.pdfbox.org 11 | 12 | Based on source code originally developed in the PaDaF project. 13 | Copyright (c) 2010 Atos Worldline SAS 14 | 15 | Includes the Adobe Glyph List 16 | Copyright 1997, 1998, 2002, 2007, 2010 Adobe Systems Incorporated. 17 | 18 | Includes the Zapf Dingbats Glyph List 19 | Copyright 2002, 2010 Adobe Systems Incorporated. 20 | 21 | Includes OSXAdapter 22 | Copyright (C) 2003-2007 Apple, Inc., All Rights Reserved 23 | -------------------------------------------------------------------------------- /licenses/poi-3.13.jar.sha1: -------------------------------------------------------------------------------- 1 | 0f59f504ba8c521e61e25f417ec652fd485010f3 -------------------------------------------------------------------------------- /licenses/poi-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache POI 2 | Copyright 2003-2015 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product contains parts that were originally based on software from BEA. 8 | Copyright (c) 2000-2003, BEA Systems, . 9 | 10 | This product contains W3C XML Schema documents. Copyright 2001-2003 (c) 11 | World Wide Web Consortium (Massachusetts Institute of Technology, European 12 | Research Consortium for Informatics and Mathematics, Keio University) 13 | 14 | This product contains the Piccolo XML Parser for Java 15 | (http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren. 16 | 17 | This product contains the chunks_parse_cmds.tbl file from the vsdump program. 18 | Copyright (C) 2006-2007 Valek Filippov (frob@df.ru) 19 | 20 | This product contains parts of the eID Applet project 21 | (http://eid-applet.googlecode.com). Copyright (c) 2009-2014 22 | FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be), 23 | Bart Hanssens from FedICT 24 | -------------------------------------------------------------------------------- /licenses/poi-ooxml-3.13.jar.sha1: -------------------------------------------------------------------------------- 1 | c364a8f5422d613e3a56db3b4b889f2989d7ee73 -------------------------------------------------------------------------------- /licenses/poi-ooxml-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache POI 2 | Copyright 2003-2015 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product contains parts that were originally based on software from BEA. 8 | Copyright (c) 2000-2003, BEA Systems, . 9 | 10 | This product contains W3C XML Schema documents. Copyright 2001-2003 (c) 11 | World Wide Web Consortium (Massachusetts Institute of Technology, European 12 | Research Consortium for Informatics and Mathematics, Keio University) 13 | 14 | This product contains the Piccolo XML Parser for Java 15 | (http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren. 16 | 17 | This product contains the chunks_parse_cmds.tbl file from the vsdump program. 18 | Copyright (C) 2006-2007 Valek Filippov (frob@df.ru) 19 | 20 | This product contains parts of the eID Applet project 21 | (http://eid-applet.googlecode.com). Copyright (c) 2009-2014 22 | FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be), 23 | Bart Hanssens from FedICT 24 | -------------------------------------------------------------------------------- /licenses/poi-ooxml-schemas-3.13.jar.sha1: -------------------------------------------------------------------------------- 1 | 56fb0b9f3ffc3d7f7fc9b59e17b5fa2c3ab921e7 -------------------------------------------------------------------------------- /licenses/poi-ooxml-schemas-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache POI 2 | Copyright 2003-2015 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product contains parts that were originally based on software from BEA. 8 | Copyright (c) 2000-2003, BEA Systems, . 9 | 10 | This product contains W3C XML Schema documents. Copyright 2001-2003 (c) 11 | World Wide Web Consortium (Massachusetts Institute of Technology, European 12 | Research Consortium for Informatics and Mathematics, Keio University) 13 | 14 | This product contains the Piccolo XML Parser for Java 15 | (http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren. 16 | 17 | This product contains the chunks_parse_cmds.tbl file from the vsdump program. 18 | Copyright (C) 2006-2007 Valek Filippov (frob@df.ru) 19 | 20 | This product contains parts of the eID Applet project 21 | (http://eid-applet.googlecode.com). Copyright (c) 2009-2014 22 | FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be), 23 | Bart Hanssens from FedICT 24 | -------------------------------------------------------------------------------- /licenses/poi-scratchpad-3.13.jar.sha1: -------------------------------------------------------------------------------- 1 | 09d763275e6c7fa05d47e2581606748669e88c55 -------------------------------------------------------------------------------- /licenses/poi-scratchpad-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache POI 2 | Copyright 2003-2015 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product contains parts that were originally based on software from BEA. 8 | Copyright (c) 2000-2003, BEA Systems, . 9 | 10 | This product contains W3C XML Schema documents. Copyright 2001-2003 (c) 11 | World Wide Web Consortium (Massachusetts Institute of Technology, European 12 | Research Consortium for Informatics and Mathematics, Keio University) 13 | 14 | This product contains the Piccolo XML Parser for Java 15 | (http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren. 16 | 17 | This product contains the chunks_parse_cmds.tbl file from the vsdump program. 18 | Copyright (C) 2006-2007 Valek Filippov (frob@df.ru) 19 | 20 | This product contains parts of the eID Applet project 21 | (http://eid-applet.googlecode.com). Copyright (c) 2009-2014 22 | FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be), 23 | Bart Hanssens from FedICT 24 | -------------------------------------------------------------------------------- /licenses/stax-api-1.0.1.jar.sha1: -------------------------------------------------------------------------------- 1 | 49c100caf72d658aca8e58bd74a4ba90fa2b0d70 -------------------------------------------------------------------------------- /licenses/stax-api-LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /licenses/stax-api-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/stax-api-NOTICE.txt -------------------------------------------------------------------------------- /licenses/tagsoup-1.2.1.jar.sha1: -------------------------------------------------------------------------------- 1 | 5584627487e984c03456266d3f8802eb85a9ce97 2 | -------------------------------------------------------------------------------- /licenses/tagsoup-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /licenses/tagsoup-NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/licenses/tagsoup-NOTICE.txt -------------------------------------------------------------------------------- /licenses/tika-core-1.11.jar.sha1: -------------------------------------------------------------------------------- 1 | d37a6b9080c8361e47b2050f69833fd61501ede9 -------------------------------------------------------------------------------- /licenses/tika-core-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Tika 2 | Copyright 2015 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata 8 | This software contains code derived from UCAR/Unidata's NetCDF library. 9 | 10 | Tika-server component uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and 11 | Grizzly (http://grizzly.java.net/) 12 | 13 | Tika-parsers component uses CDDL/LGPL dual-licensed dependency: jhighlight (https://github.com/codelibs/jhighlight) 14 | 15 | OpenCSV: Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0 16 | 17 | IPTC Photo Metadata descriptions Copyright 2010 International Press Telecommunications Council. 18 | -------------------------------------------------------------------------------- /licenses/tika-parsers-1.11.jar.sha1: -------------------------------------------------------------------------------- 1 | 355dc05d842ed223fc682da472229473ba706d68 -------------------------------------------------------------------------------- /licenses/tika-parsers-NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Tika 2 | Copyright 2015 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Copyright 1993-2010 University Corporation for Atmospheric Research/Unidata 8 | This software contains code derived from UCAR/Unidata's NetCDF library. 9 | 10 | Tika-server component uses CDDL-licensed dependencies: jersey (http://jersey.java.net/) and 11 | Grizzly (http://grizzly.java.net/) 12 | 13 | Tika-parsers component uses CDDL/LGPL dual-licensed dependency: jhighlight (https://github.com/codelibs/jhighlight) 14 | 15 | OpenCSV: Copyright 2005 Bytecode Pty Ltd. Licensed under the Apache License, Version 2.0 16 | 17 | IPTC Photo Metadata descriptions Copyright 2010 International Press Telecommunications Council. 18 | -------------------------------------------------------------------------------- /licenses/xmlbeans-2.6.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 29e80d2dd51f9dcdef8f9ffaee0d4dc1c9bbfc87 2 | -------------------------------------------------------------------------------- /licenses/xmlbeans-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /licenses/xmlbeans-NOTICE.txt: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to section 4(d) of the Apache License, == 3 | == Version 2.0, in this case for the Apache XmlBeans distribution. == 4 | ========================================================================= 5 | 6 | This product includes software developed by 7 | The Apache Software Foundation (http://www.apache.org/). 8 | 9 | Portions of this software were originally based on the following: 10 | - software copyright (c) 2000-2003, BEA Systems, . 11 | 12 | Aside from contributions to the Apache XMLBeans project, this 13 | software also includes: 14 | 15 | - one or more source files from the Apache Xerces-J and Apache Axis 16 | products, Copyright (c) 1999-2003 Apache Software Foundation 17 | 18 | - W3C XML Schema documents Copyright 2001-2003 (c) World Wide Web 19 | Consortium (Massachusetts Institute of Technology, European Research 20 | Consortium for Informatics and Mathematics, Keio University) 21 | 22 | - resolver.jar from Apache Xml Commons project, 23 | Copyright (c) 2001-2003 Apache Software Foundation 24 | 25 | - Piccolo XML Parser for Java from http://piccolo.sourceforge.net/, 26 | Copyright 2002 Yuval Oren under the terms of the Apache Software License 2.0 27 | 28 | - JSR-173 Streaming API for XML from http://sourceforge.net/projects/xmlpullparser/, 29 | Copyright 2005 BEA under the terms of the Apache Software License 2.0 30 | -------------------------------------------------------------------------------- /src/main/java/org/elasticsearch/mapper/attachments/MapperAttachmentsPlugin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.index.IndexService; 23 | import org.elasticsearch.plugins.Plugin; 24 | 25 | public class MapperAttachmentsPlugin extends Plugin { 26 | 27 | @Override 28 | public String name() { 29 | return "mapper-attachments"; 30 | } 31 | 32 | @Override 33 | public String description() { 34 | return "Adds the attachment type allowing to parse difference attachment formats"; 35 | } 36 | 37 | @Override 38 | public void onIndexService(IndexService indexService) { 39 | indexService.mapperService().documentMapperParser().putTypeParser("attachment", new AttachmentMapper.TypeParser()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/elasticsearch/mapper/attachments/TikaImpl.java: -------------------------------------------------------------------------------- 1 | package org.elasticsearch.mapper.attachments; 2 | 3 | import java.io.IOException; 4 | import java.security.AccessController; 5 | import java.security.PrivilegedActionException; 6 | import java.security.PrivilegedExceptionAction; 7 | 8 | import org.apache.tika.Tika; 9 | import org.apache.tika.exception.TikaException; 10 | import org.apache.tika.metadata.Metadata; 11 | import org.apache.tika.parser.AutoDetectParser; 12 | import org.apache.tika.parser.Parser; 13 | import org.elasticsearch.SpecialPermission; 14 | import org.elasticsearch.common.io.stream.StreamInput; 15 | 16 | /** do NOT make public */ 17 | final class TikaImpl { 18 | 19 | /** subset of parsers for types we support */ 20 | private static final Parser PARSERS[] = new Parser[] { 21 | // documents 22 | new org.apache.tika.parser.html.HtmlParser(), 23 | new org.apache.tika.parser.rtf.RTFParser(), 24 | new org.apache.tika.parser.pdf.PDFParser(), 25 | new org.apache.tika.parser.txt.TXTParser(), 26 | new org.apache.tika.parser.microsoft.OfficeParser(), 27 | new org.apache.tika.parser.microsoft.OldExcelParser(), 28 | new org.apache.tika.parser.microsoft.ooxml.OOXMLParser(), 29 | new org.apache.tika.parser.odf.OpenDocumentParser(), 30 | new org.apache.tika.parser.iwork.IWorkPackageParser(), 31 | new org.apache.tika.parser.xml.DcXMLParser(), 32 | }; 33 | 34 | /** autodetector based on this subset */ 35 | private static final AutoDetectParser PARSER_INSTANCE = new AutoDetectParser(PARSERS); 36 | 37 | /** singleton tika instance */ 38 | private static final Tika TIKA_INSTANCE = new Tika(PARSER_INSTANCE.getDetector(), PARSER_INSTANCE); 39 | 40 | /** 41 | * parses with tika, throwing any exception hit while parsing the document 42 | */ 43 | // only package private for testing! 44 | static String parse(final byte content[], final Metadata metadata, final int limit) throws TikaException, IOException { 45 | // check that its not unprivileged code like a script 46 | SecurityManager sm = System.getSecurityManager(); 47 | if (sm != null) { 48 | sm.checkPermission(new SpecialPermission()); 49 | } 50 | 51 | try { 52 | return AccessController.doPrivileged(new PrivilegedExceptionAction() { 53 | @Override 54 | public String run() throws TikaException, IOException { 55 | return TIKA_INSTANCE.parseToString(StreamInput.wrap(content), metadata, limit); 56 | } 57 | }); 58 | } catch (PrivilegedActionException e) { 59 | // checked exception from tika: unbox it 60 | Throwable cause = e.getCause(); 61 | if (cause instanceof TikaException) { 62 | throw (TikaException) cause; 63 | } else if (cause instanceof IOException) { 64 | throw (IOException) cause; 65 | } else { 66 | throw new AssertionError(cause); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/plugin-metadata/plugin-security.policy: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | grant { 21 | // TODO: fix tika not to actually install bouncy castle like this 22 | permission java.security.SecurityPermission "putProviderProperty.BC"; 23 | permission java.security.SecurityPermission "insertProvider"; 24 | // TODO: fix POI XWPF to not do this: https://bz.apache.org/bugzilla/show_bug.cgi?id=58597 25 | permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; 26 | }; 27 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/AttachmentUnitTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.Version; 23 | import org.elasticsearch.cluster.metadata.IndexMetaData; 24 | import org.elasticsearch.common.settings.Settings; 25 | import org.elasticsearch.test.ESTestCase; 26 | import org.junit.Before; 27 | 28 | public class AttachmentUnitTestCase extends ESTestCase { 29 | 30 | protected Settings testSettings; 31 | 32 | @Before 33 | public void createSettings() throws Exception { 34 | testSettings = Settings.builder() 35 | .put("path.home", createTempDir()) 36 | .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT.id) 37 | .build(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/DateAttachmentMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.common.settings.Settings; 23 | import org.elasticsearch.index.mapper.DocumentMapper; 24 | import org.elasticsearch.index.mapper.DocumentMapperParser; 25 | import org.elasticsearch.index.mapper.core.StringFieldMapper; 26 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 27 | import org.junit.Before; 28 | 29 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 30 | import static org.hamcrest.Matchers.instanceOf; 31 | 32 | /** 33 | * 34 | */ 35 | public class DateAttachmentMapperTests extends AttachmentUnitTestCase { 36 | 37 | private DocumentMapperParser mapperParser; 38 | 39 | @Before 40 | public void setupMapperParser() throws Exception { 41 | mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 42 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 43 | } 44 | 45 | public void testSimpleMappings() throws Exception { 46 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/date/date-mapping.json"); 47 | DocumentMapper docMapper = mapperParser.parse(mapping); 48 | 49 | // Our mapping should be kept as a String 50 | assertThat(docMapper.mappers().getMapper("file.date"), instanceOf(StringFieldMapper.class)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/EncryptedDocMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.common.bytes.BytesReference; 23 | import org.elasticsearch.common.settings.Settings; 24 | import org.elasticsearch.index.mapper.DocumentMapper; 25 | import org.elasticsearch.index.mapper.DocumentMapperParser; 26 | import org.elasticsearch.index.mapper.MapperParsingException; 27 | import org.elasticsearch.index.mapper.ParseContext; 28 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 29 | 30 | import java.io.IOException; 31 | 32 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 33 | import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; 34 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 35 | import static org.hamcrest.Matchers.*; 36 | 37 | /** 38 | * Test for https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/18 39 | * Note that we have converted /org/elasticsearch/index/mapper/xcontent/testContentLength.txt 40 | * to a /org/elasticsearch/index/mapper/xcontent/encrypted.pdf with password `12345678`. 41 | */ 42 | public class EncryptedDocMapperTests extends AttachmentUnitTestCase { 43 | 44 | public void testMultipleDocsEncryptedLast() throws IOException { 45 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 46 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 47 | 48 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/encrypted/test-mapping.json"); 49 | DocumentMapper docMapper = mapperParser.parse(mapping); 50 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithValidDateMeta.html"); 51 | byte[] pdf = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/encrypted.pdf"); 52 | 53 | BytesReference json = jsonBuilder() 54 | .startObject() 55 | .field("file1", html) 56 | .field("file2", pdf) 57 | .endObject().bytes(); 58 | 59 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 60 | assertThat(doc.get(docMapper.mappers().getMapper("file1.content").fieldType().names().indexName()), containsString("World")); 61 | assertThat(doc.get(docMapper.mappers().getMapper("file1.title").fieldType().names().indexName()), equalTo("Hello")); 62 | assertThat(doc.get(docMapper.mappers().getMapper("file1.author").fieldType().names().indexName()), equalTo("kimchy")); 63 | assertThat(doc.get(docMapper.mappers().getMapper("file1.keywords").fieldType().names().indexName()), equalTo("elasticsearch,cool,bonsai")); 64 | assertThat(doc.get(docMapper.mappers().getMapper("file1.content_type").fieldType().names().indexName()), equalTo("text/html; charset=ISO-8859-1")); 65 | assertThat(doc.getField(docMapper.mappers().getMapper("file1.content_length").fieldType().names().indexName()).numericValue().longValue(), is(344L)); 66 | 67 | assertThat(doc.get(docMapper.mappers().getMapper("file2").fieldType().names().indexName()), nullValue()); 68 | assertThat(doc.get(docMapper.mappers().getMapper("file2.title").fieldType().names().indexName()), nullValue()); 69 | assertThat(doc.get(docMapper.mappers().getMapper("file2.author").fieldType().names().indexName()), nullValue()); 70 | assertThat(doc.get(docMapper.mappers().getMapper("file2.keywords").fieldType().names().indexName()), nullValue()); 71 | assertThat(doc.get(docMapper.mappers().getMapper("file2.content_type").fieldType().names().indexName()), nullValue()); 72 | assertThat(doc.getField(docMapper.mappers().getMapper("file2.content_length").fieldType().names().indexName()), nullValue()); 73 | } 74 | 75 | public void testMultipleDocsEncryptedFirst() throws IOException { 76 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 77 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 78 | 79 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/encrypted/test-mapping.json"); 80 | DocumentMapper docMapper = mapperParser.parse(mapping); 81 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithValidDateMeta.html"); 82 | byte[] pdf = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/encrypted.pdf"); 83 | 84 | BytesReference json = jsonBuilder() 85 | .startObject() 86 | .field("file1", pdf) 87 | .field("file2", html) 88 | .endObject().bytes(); 89 | 90 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 91 | assertThat(doc.get(docMapper.mappers().getMapper("file1").fieldType().names().indexName()), nullValue()); 92 | assertThat(doc.get(docMapper.mappers().getMapper("file1.title").fieldType().names().indexName()), nullValue()); 93 | assertThat(doc.get(docMapper.mappers().getMapper("file1.author").fieldType().names().indexName()), nullValue()); 94 | assertThat(doc.get(docMapper.mappers().getMapper("file1.keywords").fieldType().names().indexName()), nullValue()); 95 | assertThat(doc.get(docMapper.mappers().getMapper("file1.content_type").fieldType().names().indexName()), nullValue()); 96 | assertThat(doc.getField(docMapper.mappers().getMapper("file1.content_length").fieldType().names().indexName()), nullValue()); 97 | 98 | assertThat(doc.get(docMapper.mappers().getMapper("file2.content").fieldType().names().indexName()), containsString("World")); 99 | assertThat(doc.get(docMapper.mappers().getMapper("file2.title").fieldType().names().indexName()), equalTo("Hello")); 100 | assertThat(doc.get(docMapper.mappers().getMapper("file2.author").fieldType().names().indexName()), equalTo("kimchy")); 101 | assertThat(doc.get(docMapper.mappers().getMapper("file2.keywords").fieldType().names().indexName()), equalTo("elasticsearch,cool,bonsai")); 102 | assertThat(doc.get(docMapper.mappers().getMapper("file2.content_type").fieldType().names().indexName()), equalTo("text/html; charset=ISO-8859-1")); 103 | assertThat(doc.getField(docMapper.mappers().getMapper("file2.content_length").fieldType().names().indexName()).numericValue().longValue(), is(344L)); 104 | } 105 | 106 | public void testMultipleDocsEncryptedNotIgnoringErrors() throws IOException { 107 | try { 108 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), 109 | Settings.builder() 110 | .put("index.mapping.attachment.ignore_errors", false) 111 | .build()).documentMapperParser(); 112 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 113 | 114 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/encrypted/test-mapping.json"); 115 | DocumentMapper docMapper = mapperParser.parse(mapping); 116 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithValidDateMeta.html"); 117 | byte[] pdf = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/encrypted.pdf"); 118 | 119 | BytesReference json = jsonBuilder() 120 | .startObject() 121 | .field("file1", pdf) 122 | .field("file2", html) 123 | .endObject().bytes(); 124 | 125 | docMapper.parse("person", "person", "1", json); 126 | fail("Expected doc parsing exception"); 127 | } catch (MapperParsingException e) { 128 | if (e.getMessage() == null || e.getMessage().contains("is encrypted") == false) { 129 | // wrong exception 130 | throw e; 131 | } 132 | } 133 | } 134 | 135 | } 136 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/LanguageDetectionAttachmentMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.common.settings.Settings; 23 | import org.elasticsearch.common.xcontent.XContentBuilder; 24 | import org.elasticsearch.index.mapper.DocumentMapper; 25 | import org.elasticsearch.index.mapper.DocumentMapperParser; 26 | import org.elasticsearch.index.mapper.ParseContext; 27 | import org.elasticsearch.index.mapper.core.StringFieldMapper; 28 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 29 | import org.junit.Before; 30 | 31 | import java.io.IOException; 32 | 33 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 34 | import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; 35 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 36 | import static org.hamcrest.Matchers.equalTo; 37 | import static org.hamcrest.Matchers.instanceOf; 38 | 39 | /** 40 | * 41 | */ 42 | public class LanguageDetectionAttachmentMapperTests extends AttachmentUnitTestCase { 43 | 44 | private DocumentMapper docMapper; 45 | 46 | @Before 47 | public void setupMapperParser() throws IOException { 48 | setupMapperParser(true); 49 | } 50 | 51 | public void setupMapperParser(boolean langDetect) throws IOException { 52 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), 53 | Settings.settingsBuilder() 54 | .put("index.mapping.attachment.detect_language", langDetect) 55 | .build()).documentMapperParser(); 56 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 57 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/language/language-mapping.json"); 58 | docMapper = mapperParser.parse(mapping); 59 | 60 | assertThat(docMapper.mappers().getMapper("file.language"), instanceOf(StringFieldMapper.class)); 61 | } 62 | 63 | private void testLanguage(String filename, String expected, String... forcedLanguage) throws IOException { 64 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/" + filename); 65 | 66 | XContentBuilder xcb = jsonBuilder() 67 | .startObject() 68 | .startObject("file") 69 | .field("_name", filename) 70 | .field("_content", html); 71 | 72 | if (forcedLanguage.length > 0) { 73 | xcb.field("_language", forcedLanguage[0]); 74 | } 75 | 76 | xcb.endObject().endObject(); 77 | 78 | ParseContext.Document doc = docMapper.parse("person", "person", "1", xcb.bytes()).rootDoc(); 79 | 80 | // Our mapping should be kept as a String 81 | assertThat(doc.get(docMapper.mappers().getMapper("file.language").fieldType().names().indexName()), equalTo(expected)); 82 | } 83 | 84 | public void testFrDetection() throws Exception { 85 | testLanguage("text-in-french.txt", "fr"); 86 | } 87 | 88 | public void testEnDetection() throws Exception { 89 | testLanguage("text-in-english.txt", "en"); 90 | } 91 | 92 | public void testFrForced() throws Exception { 93 | testLanguage("text-in-english.txt", "fr", "fr"); 94 | } 95 | 96 | /** 97 | * This test gives strange results! detection of ":-)" gives "lt" as a result 98 | */ 99 | public void testNoLanguage() throws Exception { 100 | testLanguage("text-in-nolang.txt", "lt"); 101 | } 102 | 103 | public void testLangDetectDisabled() throws Exception { 104 | // We replace the mapper with another one which have index.mapping.attachment.detect_language = false 105 | setupMapperParser(false); 106 | testLanguage("text-in-english.txt", null); 107 | } 108 | 109 | public void testLangDetectDocumentEnabled() throws Exception { 110 | // We replace the mapper with another one which have index.mapping.attachment.detect_language = false 111 | setupMapperParser(false); 112 | 113 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/text-in-english.txt"); 114 | 115 | XContentBuilder xcb = jsonBuilder() 116 | .startObject() 117 | .startObject("file") 118 | .field("_name", "text-in-english.txt") 119 | .field("_content", html) 120 | .field("_detect_language", true) 121 | .endObject().endObject(); 122 | 123 | ParseContext.Document doc = docMapper.parse("person", "person", "1", xcb.bytes()).rootDoc(); 124 | 125 | // Our mapping should be kept as a String 126 | assertThat(doc.get(docMapper.mappers().getMapper("file.language").fieldType().names().indexName()), equalTo("en")); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/MapperAttachmentsRestIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import com.carrotsearch.randomizedtesting.annotations.Name; 23 | import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; 24 | import org.elasticsearch.common.settings.Settings; 25 | import org.elasticsearch.mapper.attachments.MapperAttachmentsPlugin; 26 | import org.elasticsearch.test.rest.ESRestTestCase; 27 | import org.elasticsearch.test.rest.RestTestCandidate; 28 | import org.elasticsearch.test.rest.parser.RestTestParseException; 29 | 30 | import java.io.IOException; 31 | 32 | public class MapperAttachmentsRestIT extends ESRestTestCase { 33 | 34 | @Override 35 | protected Settings nodeSettings(int nodeOrdinal) { 36 | return Settings.builder() 37 | .put(super.nodeSettings(nodeOrdinal)) 38 | .put("plugin.types", MapperAttachmentsPlugin.class.getName()) 39 | .build(); 40 | } 41 | 42 | public MapperAttachmentsRestIT(@Name("yaml") RestTestCandidate testCandidate) { 43 | super(testCandidate); 44 | } 45 | 46 | @ParametersFactory 47 | public static Iterable parameters() throws IOException, RestTestParseException { 48 | return createParameters(0, 1); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/MapperTestUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.Version; 23 | import org.elasticsearch.cluster.metadata.IndexMetaData; 24 | import org.elasticsearch.common.settings.Settings; 25 | import org.elasticsearch.env.Environment; 26 | import org.elasticsearch.index.Index; 27 | import org.elasticsearch.index.IndexSettings; 28 | import org.elasticsearch.index.analysis.AnalysisRegistry; 29 | import org.elasticsearch.index.analysis.AnalysisService; 30 | import org.elasticsearch.index.mapper.MapperService; 31 | import org.elasticsearch.index.similarity.SimilarityService; 32 | import org.elasticsearch.test.IndexSettingsModule; 33 | 34 | import java.io.IOException; 35 | import java.nio.file.Path; 36 | import java.util.Collections; 37 | 38 | class MapperTestUtils { 39 | 40 | public static MapperService newMapperService(Path tempDir, Settings indexSettings) throws IOException { 41 | Settings nodeSettings = Settings.builder() 42 | .put("path.home", tempDir) 43 | .build(); 44 | indexSettings = Settings.builder() 45 | .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) 46 | .put(indexSettings) 47 | .build(); 48 | IndexSettings idxSettings = IndexSettingsModule.newIndexSettings(new Index("test"), indexSettings, Collections.emptyList()); 49 | AnalysisService analysisService = new AnalysisRegistry(null, new Environment(nodeSettings)).build(idxSettings); 50 | SimilarityService similarityService = new SimilarityService(idxSettings, Collections.emptyMap()); 51 | return new MapperService(idxSettings, analysisService, similarityService); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/MetadataMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.common.bytes.BytesReference; 23 | import org.elasticsearch.common.settings.Settings; 24 | import org.elasticsearch.index.mapper.DocumentMapper; 25 | import org.elasticsearch.index.mapper.DocumentMapperParser; 26 | import org.elasticsearch.index.mapper.MapperParsingException; 27 | import org.elasticsearch.index.mapper.ParseContext; 28 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 29 | 30 | import java.io.IOException; 31 | 32 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 33 | import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; 34 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 35 | import static org.hamcrest.Matchers.*; 36 | 37 | /** 38 | * Test for https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/38 39 | */ 40 | public class MetadataMapperTests extends AttachmentUnitTestCase { 41 | 42 | protected void checkMeta(String filename, Settings otherSettings, Long expectedDate, Long expectedLength) throws IOException { 43 | Settings settings = Settings.builder() 44 | .put(this.testSettings) 45 | .put(otherSettings) 46 | .build(); 47 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), settings).documentMapperParser(); 48 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 49 | 50 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/metadata/test-mapping.json"); 51 | DocumentMapper docMapper = mapperParser.parse(mapping); 52 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/" + filename); 53 | 54 | BytesReference json = jsonBuilder() 55 | .startObject() 56 | .startObject("file") 57 | .field("_name", filename) 58 | .field("_content", html) 59 | .endObject() 60 | .endObject().bytes(); 61 | 62 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 63 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), containsString("World")); 64 | assertThat(doc.get(docMapper.mappers().getMapper("file.name").fieldType().names().indexName()), equalTo(filename)); 65 | if (expectedDate == null) { 66 | assertThat(doc.getField(docMapper.mappers().getMapper("file.date").fieldType().names().indexName()), nullValue()); 67 | } else { 68 | assertThat(doc.getField(docMapper.mappers().getMapper("file.date").fieldType().names().indexName()).numericValue().longValue(), is(expectedDate)); 69 | } 70 | assertThat(doc.get(docMapper.mappers().getMapper("file.title").fieldType().names().indexName()), equalTo("Hello")); 71 | assertThat(doc.get(docMapper.mappers().getMapper("file.author").fieldType().names().indexName()), equalTo("kimchy")); 72 | assertThat(doc.get(docMapper.mappers().getMapper("file.keywords").fieldType().names().indexName()), equalTo("elasticsearch,cool,bonsai")); 73 | assertThat(doc.get(docMapper.mappers().getMapper("file.content_type").fieldType().names().indexName()), equalTo("text/html; charset=ISO-8859-1")); 74 | assertThat(doc.getField(docMapper.mappers().getMapper("file.content_length").fieldType().names().indexName()).numericValue().longValue(), is(expectedLength)); 75 | } 76 | 77 | public void testIgnoreWithoutDate() throws Exception { 78 | checkMeta("htmlWithoutDateMeta.html", Settings.builder().build(), null, 300L); 79 | } 80 | 81 | public void testIgnoreWithEmptyDate() throws Exception { 82 | checkMeta("htmlWithEmptyDateMeta.html", Settings.builder().build(), null, 334L); 83 | } 84 | 85 | public void testIgnoreWithCorrectDate() throws Exception { 86 | checkMeta("htmlWithValidDateMeta.html", Settings.builder().build(), 1354233600000L, 344L); 87 | } 88 | 89 | public void testWithoutDate() throws Exception { 90 | checkMeta("htmlWithoutDateMeta.html", Settings.builder().put("index.mapping.attachment.ignore_errors", false).build(), null, 300L); 91 | } 92 | 93 | public void testWithEmptyDate() throws Exception { 94 | try { 95 | checkMeta("htmlWithEmptyDateMeta.html", Settings.builder().put("index.mapping.attachment.ignore_errors", false).build(), null, null); 96 | } catch (MapperParsingException expected) { 97 | assertTrue(expected.getMessage().contains("failed to parse")); 98 | } 99 | } 100 | 101 | public void testWithCorrectDate() throws Exception { 102 | checkMeta("htmlWithValidDateMeta.html", Settings.builder().put("index.mapping.attachment.ignore_errors", false).build(), 1354233600000L, 344L); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/MultifieldAttachmentMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.common.Base64; 23 | import org.elasticsearch.common.settings.Settings; 24 | import org.elasticsearch.common.xcontent.XContentFactory; 25 | import org.elasticsearch.index.mapper.DocumentMapper; 26 | import org.elasticsearch.index.mapper.DocumentMapperParser; 27 | import org.elasticsearch.index.mapper.MapperService; 28 | import org.elasticsearch.index.mapper.ParsedDocument; 29 | import org.elasticsearch.index.mapper.core.DateFieldMapper; 30 | import org.elasticsearch.index.mapper.core.StringFieldMapper; 31 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 32 | import org.elasticsearch.threadpool.ThreadPool; 33 | import org.junit.After; 34 | import org.junit.Before; 35 | 36 | import java.nio.charset.StandardCharsets; 37 | 38 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 39 | import static org.hamcrest.Matchers.*; 40 | 41 | /** 42 | * 43 | */ 44 | public class MultifieldAttachmentMapperTests extends AttachmentUnitTestCase { 45 | 46 | private DocumentMapperParser mapperParser; 47 | private ThreadPool threadPool; 48 | 49 | @Before 50 | public void setupMapperParser() throws Exception { 51 | mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 52 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 53 | 54 | } 55 | 56 | @After 57 | public void cleanup() throws InterruptedException { 58 | terminate(threadPool); 59 | } 60 | 61 | public void testSimpleMappings() throws Exception { 62 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/multifield/multifield-mapping.json"); 63 | DocumentMapper docMapper = mapperParser.parse(mapping); 64 | 65 | 66 | assertThat(docMapper.mappers().getMapper("file.content"), instanceOf(StringFieldMapper.class)); 67 | assertThat(docMapper.mappers().getMapper("file.content.suggest"), instanceOf(StringFieldMapper.class)); 68 | 69 | assertThat(docMapper.mappers().getMapper("file.date"), instanceOf(DateFieldMapper.class)); 70 | assertThat(docMapper.mappers().getMapper("file.date.string"), instanceOf(StringFieldMapper.class)); 71 | 72 | assertThat(docMapper.mappers().getMapper("file.title"), instanceOf(StringFieldMapper.class)); 73 | assertThat(docMapper.mappers().getMapper("file.title.suggest"), instanceOf(StringFieldMapper.class)); 74 | 75 | assertThat(docMapper.mappers().getMapper("file.name"), instanceOf(StringFieldMapper.class)); 76 | assertThat(docMapper.mappers().getMapper("file.name.suggest"), instanceOf(StringFieldMapper.class)); 77 | 78 | assertThat(docMapper.mappers().getMapper("file.author"), instanceOf(StringFieldMapper.class)); 79 | assertThat(docMapper.mappers().getMapper("file.author.suggest"), instanceOf(StringFieldMapper.class)); 80 | 81 | assertThat(docMapper.mappers().getMapper("file.keywords"), instanceOf(StringFieldMapper.class)); 82 | assertThat(docMapper.mappers().getMapper("file.keywords.suggest"), instanceOf(StringFieldMapper.class)); 83 | 84 | assertThat(docMapper.mappers().getMapper("file.content_type"), instanceOf(StringFieldMapper.class)); 85 | assertThat(docMapper.mappers().getMapper("file.content_type.suggest"), instanceOf(StringFieldMapper.class)); 86 | } 87 | 88 | public void testExternalValues() throws Exception { 89 | String originalText = "This is an elasticsearch mapper attachment test."; 90 | String contentType = "text/plain; charset=ISO-8859-1"; 91 | String forcedName = "dummyname.txt"; 92 | 93 | String bytes = Base64.encodeBytes(originalText.getBytes(StandardCharsets.ISO_8859_1)); 94 | threadPool = new ThreadPool("testing-only"); 95 | 96 | MapperService mapperService = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY); 97 | mapperService.documentMapperParser().putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 98 | 99 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/multifield/multifield-mapping.json"); 100 | 101 | DocumentMapper documentMapper = mapperService.documentMapperParser().parse(mapping); 102 | 103 | ParsedDocument doc = documentMapper.parse("person", "person", "1", XContentFactory.jsonBuilder() 104 | .startObject() 105 | .field("file", bytes) 106 | .endObject() 107 | .bytes()); 108 | 109 | assertThat(doc.rootDoc().getField("file.content"), notNullValue()); 110 | assertThat(doc.rootDoc().getField("file.content").stringValue(), is(originalText + "\n")); 111 | 112 | assertThat(doc.rootDoc().getField("file.content_type"), notNullValue()); 113 | assertThat(doc.rootDoc().getField("file.content_type").stringValue(), is(contentType)); 114 | assertThat(doc.rootDoc().getField("file.content_type.suggest"), notNullValue()); 115 | assertThat(doc.rootDoc().getField("file.content_type.suggest").stringValue(), is(contentType)); 116 | assertThat(doc.rootDoc().getField("file.content_length"), notNullValue()); 117 | assertThat(doc.rootDoc().getField("file.content_length").numericValue().intValue(), is(originalText.length())); 118 | 119 | assertThat(doc.rootDoc().getField("file.content.suggest"), notNullValue()); 120 | assertThat(doc.rootDoc().getField("file.content.suggest").stringValue(), is(originalText + "\n")); 121 | 122 | // Let's force some values 123 | doc = documentMapper.parse("person", "person", "1", XContentFactory.jsonBuilder() 124 | .startObject() 125 | .startObject("file") 126 | .field("_content", bytes) 127 | .field("_name", forcedName) 128 | .endObject() 129 | .endObject() 130 | .bytes()); 131 | 132 | assertThat(doc.rootDoc().getField("file.content"), notNullValue()); 133 | assertThat(doc.rootDoc().getField("file.content").stringValue(), is(originalText + "\n")); 134 | 135 | assertThat(doc.rootDoc().getField("file.content_type"), notNullValue()); 136 | assertThat(doc.rootDoc().getField("file.content_type").stringValue(), is(contentType)); 137 | assertThat(doc.rootDoc().getField("file.content_type.suggest"), notNullValue()); 138 | assertThat(doc.rootDoc().getField("file.content_type.suggest").stringValue(), is(contentType)); 139 | assertThat(doc.rootDoc().getField("file.content_length"), notNullValue()); 140 | assertThat(doc.rootDoc().getField("file.content_length").numericValue().intValue(), is(originalText.length())); 141 | 142 | assertThat(doc.rootDoc().getField("file.content.suggest"), notNullValue()); 143 | assertThat(doc.rootDoc().getField("file.content.suggest").stringValue(), is(originalText + "\n")); 144 | 145 | assertThat(doc.rootDoc().getField("file.name"), notNullValue()); 146 | assertThat(doc.rootDoc().getField("file.name").stringValue(), is(forcedName)); 147 | // In mapping we have default store:false 148 | assertThat(doc.rootDoc().getField("file.name").fieldType().stored(), is(false)); 149 | assertThat(doc.rootDoc().getField("file.name.suggest"), notNullValue()); 150 | assertThat(doc.rootDoc().getField("file.name.suggest").stringValue(), is(forcedName)); 151 | // In mapping we set store:true for suggest subfield 152 | assertThat(doc.rootDoc().getField("file.name.suggest").fieldType().stored(), is(true)); 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/SimpleAttachmentMapperTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.elasticsearch.Version; 23 | import org.elasticsearch.cluster.metadata.IndexMetaData; 24 | import org.elasticsearch.common.bytes.BytesReference; 25 | import org.elasticsearch.common.settings.Settings; 26 | import org.elasticsearch.index.mapper.DocumentMapper; 27 | import org.elasticsearch.index.mapper.DocumentMapperParser; 28 | import org.elasticsearch.index.mapper.ParseContext; 29 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 30 | 31 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 32 | import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; 33 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 34 | import static org.hamcrest.Matchers.*; 35 | 36 | /** 37 | * 38 | */ 39 | public class SimpleAttachmentMapperTests extends AttachmentUnitTestCase { 40 | 41 | public void testSimpleMappings() throws Exception { 42 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 43 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 44 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping.json"); 45 | DocumentMapper docMapper = mapperParser.parse(mapping); 46 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/testXHTML.html"); 47 | 48 | BytesReference json = jsonBuilder().startObject().field("file", html).endObject().bytes(); 49 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 50 | 51 | assertThat(doc.get(docMapper.mappers().getMapper("file.content_type").fieldType().names().indexName()), startsWith("application/xhtml+xml")); 52 | assertThat(doc.get(docMapper.mappers().getMapper("file.title").fieldType().names().indexName()), equalTo("XHTML test document")); 53 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), containsString("This document tests the ability of Apache Tika to extract content")); 54 | 55 | // re-parse it 56 | String builtMapping = docMapper.mappingSource().string(); 57 | docMapper = mapperParser.parse(builtMapping); 58 | 59 | json = jsonBuilder().startObject().field("file", html).endObject().bytes(); 60 | 61 | doc = docMapper.parse("person", "person", "1", json).rootDoc(); 62 | 63 | assertThat(doc.get(docMapper.mappers().getMapper("file.content_type").fieldType().names().indexName()), startsWith("application/xhtml+xml")); 64 | assertThat(doc.get(docMapper.mappers().getMapper("file.title").fieldType().names().indexName()), equalTo("XHTML test document")); 65 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), containsString("This document tests the ability of Apache Tika to extract content")); 66 | } 67 | 68 | public void testContentBackcompat() throws Exception { 69 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), 70 | Settings.builder() 71 | .put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_1_4_2.id) 72 | .build()).documentMapperParser(); 73 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 74 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping.json"); 75 | DocumentMapper docMapper = mapperParser.parse(mapping); 76 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/testXHTML.html"); 77 | 78 | BytesReference json = jsonBuilder().startObject().field("file", html).endObject().bytes(); 79 | 80 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 81 | assertThat(doc.get("file"), containsString("This document tests the ability of Apache Tika to extract content")); 82 | } 83 | 84 | /** 85 | * test for https://github.com/elastic/elasticsearch-mapper-attachments/issues/179 86 | */ 87 | public void testSimpleMappingsWithAllFields() throws Exception { 88 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 89 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 90 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json"); 91 | DocumentMapper docMapper = mapperParser.parse(mapping); 92 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/testXHTML.html"); 93 | 94 | BytesReference json = jsonBuilder().startObject().field("file", html).endObject().bytes(); 95 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 96 | 97 | assertThat(doc.get(docMapper.mappers().getMapper("file.content_type").fieldType().names().indexName()), startsWith("application/xhtml+xml")); 98 | assertThat(doc.get(docMapper.mappers().getMapper("file.title").fieldType().names().indexName()), equalTo("XHTML test document")); 99 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), containsString("This document tests the ability of Apache Tika to extract content")); 100 | 101 | // re-parse it 102 | String builtMapping = docMapper.mappingSource().string(); 103 | docMapper = mapperParser.parse(builtMapping); 104 | 105 | json = jsonBuilder().startObject().field("file", html).endObject().bytes(); 106 | 107 | doc = docMapper.parse("person", "person", "1", json).rootDoc(); 108 | 109 | assertThat(doc.get(docMapper.mappers().getMapper("file.content_type").fieldType().names().indexName()), startsWith("application/xhtml+xml")); 110 | assertThat(doc.get(docMapper.mappers().getMapper("file.title").fieldType().names().indexName()), equalTo("XHTML test document")); 111 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), containsString("This document tests the ability of Apache Tika to extract content")); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/StandaloneRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.apache.commons.cli.CommandLine; 23 | import org.elasticsearch.common.bytes.BytesReference; 24 | import org.elasticsearch.common.cli.CliTool; 25 | import org.elasticsearch.common.cli.CliToolConfig; 26 | import org.elasticsearch.common.cli.Terminal; 27 | import org.elasticsearch.common.io.PathUtils; 28 | import org.elasticsearch.common.io.stream.BytesStreamOutput; 29 | import org.elasticsearch.common.settings.Settings; 30 | import org.elasticsearch.common.xcontent.XContentBuilder; 31 | import org.elasticsearch.env.Environment; 32 | import org.elasticsearch.index.mapper.DocumentMapper; 33 | import org.elasticsearch.index.mapper.DocumentMapperParser; 34 | import org.elasticsearch.index.mapper.ParseContext; 35 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 36 | 37 | import java.io.FileNotFoundException; 38 | import java.io.IOException; 39 | import java.io.InputStream; 40 | import java.nio.file.Files; 41 | import java.nio.file.Path; 42 | import java.util.Locale; 43 | 44 | import static org.elasticsearch.common.cli.CliToolConfig.Builder.cmd; 45 | import static org.elasticsearch.common.cli.CliToolConfig.Builder.option; 46 | import static org.elasticsearch.common.io.Streams.copy; 47 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 48 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 49 | 50 | /** 51 | * This class provides a simple main class which can be used to test what is extracted from a given binary file. 52 | * You can run it using 53 | * -u file://URL/TO/YOUR/DOC 54 | * --size set extracted size (default to mapper attachment size) 55 | * BASE64 encoded binary 56 | * 57 | * Example: 58 | * StandaloneRunner BASE64Text 59 | * StandaloneRunner -u /tmp/mydoc.pdf 60 | * StandaloneRunner -u /tmp/mydoc.pdf --size 1000000 61 | */ 62 | public class StandaloneRunner extends CliTool { 63 | 64 | private static final CliToolConfig CONFIG = CliToolConfig.config("tika", StandaloneRunner.class) 65 | .cmds(TikaRunner.CMD) 66 | .build(); 67 | 68 | static { 69 | System.setProperty("es.path.home", "/tmp"); 70 | } 71 | 72 | static class TikaRunner extends Command { 73 | private static final String NAME = "tika"; 74 | private final String url; 75 | private final Integer size; 76 | private final String base64text; 77 | private final DocumentMapper docMapper; 78 | 79 | private static final CliToolConfig.Cmd CMD = cmd(NAME, TikaRunner.class) 80 | .options(option("u", "url").required(false).hasArg(false)) 81 | .options(option("t", "size").required(false).hasArg(false)) 82 | .build(); 83 | 84 | protected TikaRunner(Terminal terminal, String url, Integer size, String base64text) throws IOException { 85 | super(terminal); 86 | this.size = size; 87 | this.url = url; 88 | this.base64text = base64text; 89 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(PathUtils.get("."), Settings.EMPTY).documentMapperParser(); // use CWD b/c it won't be used 90 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 91 | 92 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/standalone/standalone-mapping.json"); 93 | docMapper = mapperParser.parse(mapping); 94 | } 95 | 96 | @Override 97 | public ExitStatus execute(Settings settings, Environment env) throws Exception { 98 | XContentBuilder builder = jsonBuilder().startObject().field("file").startObject(); 99 | 100 | if (base64text != null) { 101 | // If base64 is provided 102 | builder.field("_content", base64text); 103 | } else { 104 | // A file is provided 105 | byte[] bytes = copyToBytes(PathUtils.get(url)); 106 | builder.field("_content", bytes); 107 | } 108 | 109 | if (size >= 0) { 110 | builder.field("_indexed_chars", size); 111 | } 112 | 113 | BytesReference json = builder.endObject().endObject().bytes(); 114 | 115 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 116 | 117 | terminal.println("## Extracted text"); 118 | terminal.println("--------------------- BEGIN -----------------------"); 119 | terminal.println("%s", doc.get("file.content")); 120 | terminal.println("---------------------- END ------------------------"); 121 | terminal.println("## Metadata"); 122 | printMetadataContent(doc, AttachmentMapper.FieldNames.AUTHOR); 123 | printMetadataContent(doc, AttachmentMapper.FieldNames.CONTENT_LENGTH); 124 | printMetadataContent(doc, AttachmentMapper.FieldNames.CONTENT_TYPE); 125 | printMetadataContent(doc, AttachmentMapper.FieldNames.DATE); 126 | printMetadataContent(doc, AttachmentMapper.FieldNames.KEYWORDS); 127 | printMetadataContent(doc, AttachmentMapper.FieldNames.LANGUAGE); 128 | printMetadataContent(doc, AttachmentMapper.FieldNames.NAME); 129 | printMetadataContent(doc, AttachmentMapper.FieldNames.TITLE); 130 | 131 | return ExitStatus.OK; 132 | } 133 | 134 | private void printMetadataContent(ParseContext.Document doc, String field) { 135 | terminal.println("- %s: %s", field, doc.get(docMapper.mappers().getMapper("file." + field).fieldType().names().indexName())); 136 | } 137 | 138 | public static byte[] copyToBytes(Path path) throws IOException { 139 | try (InputStream is = Files.newInputStream(path)) { 140 | if (is == null) { 141 | throw new FileNotFoundException("Resource [" + path + "] not found in classpath"); 142 | } 143 | try (BytesStreamOutput out = new BytesStreamOutput()) { 144 | copy(is, out); 145 | return out.bytes().toBytes(); 146 | } 147 | } 148 | } 149 | 150 | public static Command parse(Terminal terminal, CommandLine cli) throws IOException { 151 | String url = cli.getOptionValue("u"); 152 | String base64text = null; 153 | String sSize = cli.getOptionValue("size"); 154 | Integer size = sSize != null ? Integer.parseInt(sSize) : -1; 155 | if (url == null && cli.getArgs().length == 0) { 156 | return exitCmd(ExitStatus.USAGE, terminal, "url or BASE64 content should be provided (type -h for help)"); 157 | } 158 | if (url == null) { 159 | if (cli.getArgs().length == 0) { 160 | return exitCmd(ExitStatus.USAGE, terminal, "url or BASE64 content should be provided (type -h for help)"); 161 | } 162 | base64text = cli.getArgs()[0]; 163 | } else { 164 | if (cli.getArgs().length == 1) { 165 | return exitCmd(ExitStatus.USAGE, terminal, "url or BASE64 content should be provided. Not both. (type -h for help)"); 166 | } 167 | } 168 | return new TikaRunner(terminal, url, size, base64text); 169 | } 170 | } 171 | 172 | public StandaloneRunner() { 173 | super(CONFIG); 174 | } 175 | 176 | 177 | public static void main(String[] args) { 178 | StandaloneRunner pluginManager = new StandaloneRunner(); 179 | pluginManager.execute(args); 180 | } 181 | 182 | @Override 183 | protected Command parse(String cmdName, CommandLine cli) throws Exception { 184 | switch (cmdName.toLowerCase(Locale.ROOT)) { 185 | case TikaRunner.NAME: return TikaRunner.parse(terminal, cli); 186 | default: 187 | assert false : "can't get here as cmd name is validated before this method is called"; 188 | return exitCmd(ExitStatus.CODE_ERROR); 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/TikaDocTests.java: -------------------------------------------------------------------------------- 1 | package org.elasticsearch.mapper.attachments; 2 | 3 | /* 4 | * Licensed to Elasticsearch under one or more contributor 5 | * license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright 7 | * ownership. Elasticsearch licenses this file to you under 8 | * the Apache License, Version 2.0 (the "License"); you may 9 | * not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | import java.nio.file.DirectoryStream; 23 | import java.nio.file.Files; 24 | import java.nio.file.Path; 25 | 26 | import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems; 27 | import org.apache.lucene.util.TestUtil; 28 | import org.apache.tika.metadata.Metadata; 29 | 30 | import org.elasticsearch.test.ESTestCase; 31 | 32 | /** 33 | * Evil test-coverage cheat, we parse a bunch of docs from tika 34 | * so that we have a nice grab-bag variety, and assert some content 35 | * comes back and no exception. 36 | */ 37 | @SuppressFileSystems("ExtrasFS") // don't try to parse extraN 38 | public class TikaDocTests extends ESTestCase { 39 | 40 | /** some test files from tika test suite, zipped up */ 41 | static final String TIKA_FILES = "/org/elasticsearch/index/mapper/attachment/test/tika-files.zip"; 42 | 43 | public void testFiles() throws Exception { 44 | Path tmp = createTempDir(); 45 | TestUtil.unzip(getClass().getResourceAsStream(TIKA_FILES), tmp); 46 | 47 | try (DirectoryStream stream = Files.newDirectoryStream(tmp)) { 48 | for (Path doc : stream) { 49 | logger.debug("parsing: {}", doc); 50 | assertParseable(doc); 51 | } 52 | } 53 | } 54 | 55 | void assertParseable(Path fileName) throws Exception { 56 | try { 57 | byte bytes[] = Files.readAllBytes(fileName); 58 | String parsedContent = TikaImpl.parse(bytes, new Metadata(), -1); 59 | assertNotNull(parsedContent); 60 | assertFalse(parsedContent.isEmpty()); 61 | logger.debug("extracted content: {}", parsedContent); 62 | } catch (Throwable e) { 63 | throw new RuntimeException("parsing of filename: " + fileName.getFileName() + " failed", e); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/TikaImplTests.java: -------------------------------------------------------------------------------- 1 | package org.elasticsearch.mapper.attachments; 2 | 3 | import org.elasticsearch.test.ESTestCase; 4 | 5 | public class TikaImplTests extends ESTestCase { 6 | 7 | public void testTikaLoads() throws Exception { 8 | Class.forName("org.elasticsearch.mapper.attachments.TikaImpl"); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/org/elasticsearch/mapper/attachments/VariousDocTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to Elasticsearch under one or more contributor 3 | * license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright 5 | * ownership. Elasticsearch licenses this file to you under 6 | * the Apache License, Version 2.0 (the "License"); you may 7 | * not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package org.elasticsearch.mapper.attachments; 21 | 22 | import org.apache.tika.io.IOUtils; 23 | import org.apache.tika.metadata.Metadata; 24 | import org.elasticsearch.common.bytes.BytesReference; 25 | import org.elasticsearch.common.settings.Settings; 26 | import org.elasticsearch.index.mapper.DocumentMapper; 27 | import org.elasticsearch.index.mapper.DocumentMapperParser; 28 | import org.elasticsearch.index.mapper.ParseContext; 29 | import org.elasticsearch.mapper.attachments.AttachmentMapper; 30 | import org.junit.Before; 31 | 32 | import java.io.IOException; 33 | import java.io.InputStream; 34 | 35 | import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; 36 | import static org.elasticsearch.mapper.attachments.AttachmentMapper.FieldNames.*; 37 | import static org.elasticsearch.test.StreamsUtils.copyToBytesFromClasspath; 38 | import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath; 39 | import static org.hamcrest.Matchers.isEmptyOrNullString; 40 | import static org.hamcrest.Matchers.not; 41 | 42 | /** 43 | * Test for different documents 44 | */ 45 | public class VariousDocTests extends AttachmentUnitTestCase { 46 | 47 | protected DocumentMapper docMapper; 48 | 49 | @Before 50 | public void createMapper() throws IOException { 51 | DocumentMapperParser mapperParser = MapperTestUtils.newMapperService(createTempDir(), Settings.EMPTY).documentMapperParser(); 52 | mapperParser.putTypeParser(AttachmentMapper.CONTENT_TYPE, new AttachmentMapper.TypeParser()); 53 | 54 | String mapping = copyToStringFromClasspath("/org/elasticsearch/index/mapper/attachment/test/unit/various-doc/test-mapping.json"); 55 | docMapper = mapperParser.parse(mapping); 56 | } 57 | 58 | /** 59 | * Test for https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/104 60 | */ 61 | public void testWordDocxDocument104() throws Exception { 62 | assertParseable("issue-104.docx"); 63 | testMapper("issue-104.docx", false); 64 | } 65 | 66 | /** 67 | * Test for encrypted PDF 68 | */ 69 | public void testEncryptedPDFDocument() throws Exception { 70 | assertException("encrypted.pdf", "is encrypted"); 71 | // TODO Remove when this will be fixed in Tika. See https://issues.apache.org/jira/browse/TIKA-1548 72 | System.clearProperty("sun.font.fontmanager"); 73 | testMapper("encrypted.pdf", true); 74 | } 75 | 76 | /** 77 | * Test for HTML 78 | */ 79 | public void testHtmlDocument() throws Exception { 80 | assertParseable("htmlWithEmptyDateMeta.html"); 81 | testMapper("htmlWithEmptyDateMeta.html", false); 82 | } 83 | 84 | /** 85 | * Test for XHTML 86 | */ 87 | public void testXHtmlDocument() throws Exception { 88 | assertParseable("testXHTML.html"); 89 | testMapper("testXHTML.html", false); 90 | } 91 | 92 | /** 93 | * Test for TXT 94 | */ 95 | public void testTxtDocument() throws Exception { 96 | assertParseable("text-in-english.txt"); 97 | testMapper("text-in-english.txt", false); 98 | } 99 | 100 | /** 101 | * Test for ASCIIDOC 102 | * Not yet supported by Tika: https://github.com/elasticsearch/elasticsearch-mapper-attachments/issues/29 103 | */ 104 | public void testAsciidocDocument() throws Exception { 105 | assertParseable("asciidoc.asciidoc"); 106 | testMapper("asciidoc.asciidoc", false); 107 | } 108 | 109 | void assertException(String filename, String expectedMessage) throws Exception { 110 | try (InputStream is = VariousDocTests.class.getResourceAsStream("/org/elasticsearch/index/mapper/attachment/test/sample-files/" + filename)) { 111 | byte bytes[] = IOUtils.toByteArray(is); 112 | TikaImpl.parse(bytes, new Metadata(), -1); 113 | fail("expected exception"); 114 | } catch (Exception e) { 115 | if (e.getMessage() != null && e.getMessage().contains(expectedMessage)) { 116 | // ok 117 | } else { 118 | // unexpected 119 | throw e; 120 | } 121 | } 122 | } 123 | 124 | protected void assertParseable(String filename) throws Exception { 125 | try (InputStream is = VariousDocTests.class.getResourceAsStream("/org/elasticsearch/index/mapper/attachment/test/sample-files/" + filename)) { 126 | byte bytes[] = IOUtils.toByteArray(is); 127 | String parsedContent = TikaImpl.parse(bytes, new Metadata(), -1); 128 | assertThat(parsedContent, not(isEmptyOrNullString())); 129 | logger.debug("extracted content: {}", parsedContent); 130 | } 131 | } 132 | 133 | protected void testMapper(String filename, boolean errorExpected) throws IOException { 134 | byte[] html = copyToBytesFromClasspath("/org/elasticsearch/index/mapper/attachment/test/sample-files/" + filename); 135 | 136 | BytesReference json = jsonBuilder() 137 | .startObject() 138 | .startObject("file") 139 | .field("_name", filename) 140 | .field("_content", html) 141 | .endObject() 142 | .endObject().bytes(); 143 | 144 | ParseContext.Document doc = docMapper.parse("person", "person", "1", json).rootDoc(); 145 | if (!errorExpected) { 146 | assertThat(doc.get(docMapper.mappers().getMapper("file.content").fieldType().names().indexName()), not(isEmptyOrNullString())); 147 | logger.debug("-> extracted content: {}", doc.get(docMapper.mappers().getMapper("file").fieldType().names().indexName())); 148 | logger.debug("-> extracted metadata:"); 149 | printMetadataContent(doc, AUTHOR); 150 | printMetadataContent(doc, CONTENT_LENGTH); 151 | printMetadataContent(doc, CONTENT_TYPE); 152 | printMetadataContent(doc, DATE); 153 | printMetadataContent(doc, KEYWORDS); 154 | printMetadataContent(doc, LANGUAGE); 155 | printMetadataContent(doc, NAME); 156 | printMetadataContent(doc, TITLE); 157 | } 158 | } 159 | 160 | private void printMetadataContent(ParseContext.Document doc, String field) { 161 | logger.debug("- [{}]: [{}]", field, doc.get(docMapper.mappers().getMapper("file." + field).fieldType().names().indexName())); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/asciidoc.asciidoc: -------------------------------------------------------------------------------- 1 | [[tika-asciidoc]] 2 | = AsciiDoc test 3 | 4 | Here is a test of the asciidoc format. 5 | 6 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/encrypted.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/encrypted.pdf -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithEmptyDateMeta.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Hello 6 | 7 | 8 | 9 | 10 | World 11 | 12 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithValidDateMeta.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Hello 6 | 7 | 8 | 9 | 10 | World 11 | 12 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/htmlWithoutDateMeta.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | Hello 6 | 7 | 8 | 9 | World 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/issue-104.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/issue-104.docx -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/testContentLength.txt: -------------------------------------------------------------------------------- 1 | Begin 2 | 3 | BeforeLimit AfterLimit 4 | 5 | Broadway 6 | 7 | Nearing the end 8 | 9 | End -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/testXHTML.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | XHTML test document 20 | 21 | 22 | 23 | 24 |

25 | This document tests the ability of Apache Tika to extract content 26 | from an XHTML document. 27 |

28 | 29 | 30 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/text-in-english.txt: -------------------------------------------------------------------------------- 1 | "God Save the Queen" (alternatively "God Save the King" -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/text-in-french.txt: -------------------------------------------------------------------------------- 1 | Allons enfants de la Patrie Le jour de gloire est arrivé. Contre nous de la tyrannie -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/text-in-nolang.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/src/test/resources/org/elasticsearch/index/mapper/attachment/test/sample-files/text-in-nolang.txt -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/standalone/standalone-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file":{ 5 | "type":"attachment" 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/tika-files.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/elastic/elasticsearch-mapper-attachments/339bb68249fc2c25777c12ed4d56f2eca58a3ea7/src/test/resources/org/elasticsearch/index/mapper/attachment/test/tika-files.zip -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/date/date-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person": { 3 | "properties": { 4 | "file": { 5 | "type": "attachment", 6 | "fields": { 7 | "date": { "type": "string" } 8 | } 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/encrypted/test-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file1":{ 5 | "type":"attachment" 6 | }, 7 | "file2":{ 8 | "type":"attachment" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/language/language-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person": { 3 | "properties": { 4 | "file": { 5 | "type": "attachment", 6 | "fields": { 7 | "language": { "type": "string" } 8 | } 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/metadata/test-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file":{ 5 | "type":"attachment" 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/multifield/multifield-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person": { 3 | "properties": { 4 | "file": { 5 | "type": "attachment", 6 | "fields": { 7 | "content": { 8 | "type": "string", 9 | "fields": { 10 | "suggest": { "type": "string" } 11 | } 12 | }, 13 | "date": { 14 | "type": "date", 15 | "fields": { 16 | "string": { "type": "string" } 17 | } 18 | }, 19 | "title": { 20 | "type": "string", 21 | "fields": { 22 | "suggest": { "type": "string" } 23 | } 24 | }, 25 | "name": { 26 | "type": "string", 27 | "fields": { 28 | "suggest": { 29 | "type": "string", 30 | "store": true 31 | } 32 | } 33 | }, 34 | "author": { 35 | "type": "string", 36 | "fields": { 37 | "suggest": { "type": "string" } 38 | } 39 | }, 40 | "keywords": { 41 | "type": "string", 42 | "fields": { 43 | "suggest": { "type": "string" } 44 | } 45 | }, 46 | "content_type": { 47 | "type": "string", 48 | "fields": { 49 | "suggest": { "type": "string" } 50 | } 51 | } 52 | } 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping-all-fields.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file":{ 5 | "type":"attachment", 6 | "fields" : { 7 | "content" : {"store" : "yes"}, 8 | "title" : {"store" : "yes"}, 9 | "date" : {"store" : "yes"}, 10 | "author" : {"analyzer" : "standard"}, 11 | "keywords" : {"store" : "yes"}, 12 | "content_type" : {"store" : "yes"}, 13 | "content_length" : {"store" : "yes"}, 14 | "language" : {"store" : "yes"} 15 | } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/simple/test-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file":{ 5 | "type":"attachment" 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/org/elasticsearch/index/mapper/attachment/test/unit/various-doc/test-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "person":{ 3 | "properties":{ 4 | "file":{ 5 | "type":"attachment" 6 | } 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/rest-api-spec/test/mapper_attachments/00_basic.yaml: -------------------------------------------------------------------------------- 1 | # Integration tests for plugin: check name is correct 2 | # 3 | "Mapper attachments loaded": 4 | - do: 5 | cluster.state: {} 6 | 7 | # Get master node id 8 | - set: { master_node: master } 9 | 10 | - do: 11 | nodes.info: {} 12 | 13 | - match: { nodes.$master.plugins.0.name: mapper-attachments } 14 | - match: { nodes.$master.plugins.0.jvm: true } 15 | -------------------------------------------------------------------------------- /src/test/resources/rest-api-spec/test/mapper_attachments/20_search.yaml: -------------------------------------------------------------------------------- 1 | # Integration tests for Mapper Attachments plugin 2 | # 3 | 4 | setup: 5 | - do: 6 | indices.create: 7 | index: test 8 | body: 9 | mappings: 10 | doc: 11 | properties: 12 | file: 13 | type: attachment 14 | - do: 15 | cluster.health: 16 | wait_for_status: yellow 17 | 18 | --- 19 | # Encoded content with https://www.base64encode.org/ 20 | # 21 | # 22 | # XHTML test document 23 | # 24 | # 25 | # 26 | # 27 | #

28 | # This document tests the ability of Apache Tika to extract content 29 | # from an XHTML document. 30 | #

31 | # 32 | # 33 | 34 | "Mapper Attachment Simple": 35 | 36 | - do: 37 | index: 38 | index: test 39 | type: doc 40 | id: 1 41 | body: 42 | file: "PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPg0KPGhlYWQ+DQogICAgPHRpdGxlPlhIVE1MIHRlc3QgZG9jdW1lbnQ8L3RpdGxlPg0KICAgIDxtZXRhIG5hbWU9IkF1dGhvciIgY29udGVudD0iVGlrYSBEZXZlbG9wZXJzIi8+DQogICAgPG1ldGEgaHR0cC1lcXVpdj0icmVmcmVzaCIgY29udGVudD0iNSIvPg0KPC9oZWFkPg0KPGJvZHk+DQo8cD4NCiAgICBUaGlzIGRvY3VtZW50IHRlc3RzIHRoZSBhYmlsaXR5IG9mIEFwYWNoZSBUaWthIHRvIGV4dHJhY3QgY29udGVudA0KICAgIGZyb20gYW4gPGEgaHJlZj0iaHR0cDovL3d3dy53My5vcmcvVFIveGh0bWwxLyI+WEhUTUwgZG9jdW1lbnQ8L2E+Lg0KPC9wPg0KPC9ib2R5Pg0KPC9odG1sPg==" 43 | 44 | - do: 45 | indices.refresh: {} 46 | 47 | - do: 48 | search: 49 | index: test 50 | body: 51 | query: 52 | match: 53 | file.title: "test document" 54 | 55 | - match: { hits.total: 1 } 56 | 57 | --- 58 | # Encoded content with https://www.base64encode.org/ 59 | #Begin 60 | # 61 | #BeforeLimit AfterLimit 62 | # 63 | #Broadway 64 | # 65 | #Nearing the end 66 | # 67 | #End 68 | 69 | "Mapper Attachment ContentLength Limit": 70 | 71 | - do: 72 | index: 73 | index: test 74 | type: doc 75 | id: "withlimit" 76 | body: 77 | file: 78 | _indexed_chars: 20 79 | _content: "QmVnaW4NCg0KQmVmb3JlTGltaXQgQWZ0ZXJMaW1pdA0KDQpCcm9hZHdheQ0KDQpOZWFyaW5nIHRoZSBlbmQNCg0KRW5k" 80 | 81 | - do: 82 | index: 83 | index: test 84 | type: doc 85 | id: "nolimit" 86 | body: 87 | file: 88 | _indexed_chars: -1 89 | _content: "QmVnaW4NCg0KQmVmb3JlTGltaXQgQWZ0ZXJMaW1pdA0KDQpCcm9hZHdheQ0KDQpOZWFyaW5nIHRoZSBlbmQNCg0KRW5k" 90 | 91 | - do: 92 | indices.refresh: {} 93 | 94 | - do: 95 | search: 96 | index: test 97 | body: 98 | query: 99 | match: 100 | file.content: "BeforeLimit" 101 | 102 | - match: { hits.total: 2 } 103 | 104 | - do: 105 | search: 106 | index: test 107 | body: 108 | query: 109 | match: 110 | file.content: "AfterLimit" 111 | 112 | - match: { hits.total: 1 } 113 | - match: { hits.hits.0._id: "nolimit" } 114 | 115 | -------------------------------------------------------------------------------- /src/test/resources/rest-api-spec/test/mapper_attachments/30_mapping.yaml: -------------------------------------------------------------------------------- 1 | # Integration tests for Mapper Attachments plugin 2 | # 3 | 4 | --- 5 | # Encoded content with https://www.base64encode.org/ 6 | # 7 | # 8 | # XHTML test document 9 | # 10 | # 11 | # 12 | # 13 | #

14 | # This document tests the ability of Apache Tika to extract content 15 | # from an XHTML document. 16 | #

17 | # 18 | # 19 | "ContentType and Name": 20 | 21 | - do: 22 | indices.create: 23 | index: test 24 | body: 25 | mappings: 26 | doc: 27 | properties: 28 | "file": 29 | "type": "attachment" 30 | "fields": 31 | "content_type": 32 | "store": "yes" 33 | "name": 34 | "store": "yes" 35 | - do: 36 | cluster.health: 37 | wait_for_status: yellow 38 | 39 | - do: 40 | index: 41 | index: test 42 | type: doc 43 | id: 1 44 | body: 45 | file: 46 | _content: "QmVnaW4NCg0KQmVmb3JlTGltaXQgQWZ0ZXJMaW1pdA0KDQpCcm9hZHdheQ0KDQpOZWFyaW5nIHRoZSBlbmQNCg0KRW5k" 47 | _content_type: "text/my-dummy-content-type" 48 | _name: "my-dummy-name-txt" 49 | 50 | - do: 51 | indices.refresh: {} 52 | 53 | - do: 54 | search: 55 | index: test 56 | body: 57 | fields: [file.content_type,file.name] 58 | 59 | - match: { hits.total: 1 } 60 | - match: { hits.hits.0.fields: { file.content_type: ["text/my-dummy-content-type"], file.name: ["my-dummy-name-txt"] }} 61 | 62 | -------------------------------------------------------------------------------- /src/test/resources/rest-api-spec/test/mapper_attachments/40_highlight.yaml: -------------------------------------------------------------------------------- 1 | # Integration tests for Mapper Attachments plugin 2 | # 3 | 4 | setup: 5 | - do: 6 | indices.create: 7 | index: test 8 | body: 9 | mappings: 10 | doc: 11 | properties: 12 | "file": 13 | "type": "attachment" 14 | "fields": 15 | "content" : 16 | "type": "string" 17 | "store" : "yes" 18 | "term_vector": "with_positions_offsets" 19 | 20 | - do: 21 | cluster.health: 22 | wait_for_status: yellow 23 | 24 | --- 25 | # Encoded content with https://www.base64encode.org/ 26 | # 27 | # 28 | # XHTML test document 29 | # 30 | # 31 | # 32 | # 33 | #

34 | # This document tests the ability of Apache Tika to extract content 35 | # from an XHTML document. 36 | #

37 | # 38 | # 39 | 40 | "Highlight content": 41 | 42 | - do: 43 | index: 44 | index: test 45 | type: doc 46 | id: 1 47 | body: 48 | file: "PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPg0KPGhlYWQ+DQogICAgPHRpdGxlPlhIVE1MIHRlc3QgZG9jdW1lbnQ8L3RpdGxlPg0KICAgIDxtZXRhIG5hbWU9IkF1dGhvciIgY29udGVudD0iVGlrYSBEZXZlbG9wZXJzIi8+DQogICAgPG1ldGEgaHR0cC1lcXVpdj0icmVmcmVzaCIgY29udGVudD0iNSIvPg0KPC9oZWFkPg0KPGJvZHk+DQo8cD4NCiAgICBUaGlzIGRvY3VtZW50IHRlc3RzIHRoZSBhYmlsaXR5IG9mIEFwYWNoZSBUaWthIHRvIGV4dHJhY3QgY29udGVudA0KICAgIGZyb20gYW4gPGEgaHJlZj0iaHR0cDovL3d3dy53My5vcmcvVFIveGh0bWwxLyI+WEhUTUwgZG9jdW1lbnQ8L2E+Lg0KPC9wPg0KPC9ib2R5Pg0KPC9odG1sPg==" 49 | 50 | - do: 51 | indices.refresh: {} 52 | 53 | - do: 54 | search: 55 | index: test 56 | body: 57 | query: 58 | match: 59 | file.content: "apache tika" 60 | fields: [] 61 | highlight: 62 | fields: 63 | file.content: {} 64 | 65 | - match: { hits.total: 1 } 66 | - match: { hits.hits.0.highlight: { file.content : [ "\n\n This document tests the ability of Apache Tika to extract content\n from an XHTML document.\n" ] }} 67 | 68 | --------------------------------------------------------------------------------