├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── branch-cicd.yaml │ ├── codeql-analysis.yaml │ ├── secrets-detection.yaml │ ├── stable-cicd.yaml │ └── unstable-cicd.yaml ├── .gitignore ├── .pre-commit-config.yaml ├── .secrets.baseline ├── .zenodo.json ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── docs ├── requirements │ ├── v1.11.1 │ │ └── REQUIREMENTS.md │ ├── v1.11.2 │ │ └── REQUIREMENTS.md │ ├── v1.11.3 │ │ └── REQUIREMENTS.md │ ├── v1.11.4 │ │ └── REQUIREMENTS.md │ ├── v1.11.5 │ │ └── REQUIREMENTS.md │ ├── v1.12.0 │ │ └── REQUIREMENTS.md │ ├── v1.12.2 │ │ └── REQUIREMENTS.md │ ├── v1.13.0 │ │ └── REQUIREMENTS.md │ ├── v1.13.1 │ │ └── REQUIREMENTS.md │ └── v1.13.2 │ │ └── REQUIREMENTS.md ├── transform-tool.pptx └── transform_requirements.pdf ├── pom.xml └── src ├── changes └── changes.xml ├── main ├── assembly │ ├── tar-assembly.xml │ └── zip-assembly.xml ├── bin │ ├── transform │ └── transform.bat ├── java │ └── gov │ │ └── nasa │ │ └── pds │ │ └── transform │ │ ├── TransformException.java │ │ ├── TransformLauncher.java │ │ ├── commandline │ │ └── options │ │ │ ├── Flag.java │ │ │ ├── InvalidOptionException.java │ │ │ └── ToolsOption.java │ │ ├── constants │ │ └── Constants.java │ │ ├── logging │ │ ├── ToolsLevel.java │ │ ├── ToolsLogRecord.java │ │ ├── filter │ │ │ └── ToolsLogFilter.java │ │ ├── format │ │ │ └── TransformFormatter.java │ │ └── handler │ │ │ ├── TransformFileHandler.java │ │ │ └── TransformStreamHandler.java │ │ ├── product │ │ ├── DefaultTransformer.java │ │ ├── Pds3ImageTransformer.java │ │ ├── Pds3LabelTransformer.java │ │ ├── Pds3TableTransformer.java │ │ ├── Pds4ImageTransformer.java │ │ ├── Pds4LabelTransformer.java │ │ ├── Pds4TableTransformer.java │ │ ├── Pds4ToPds3LabelTransformer.java │ │ ├── ProductTransformer.java │ │ ├── ProductTransformerFactory.java │ │ ├── StylesheetTransformer.java │ │ ├── label │ │ │ ├── BinaryTableLabelTransformer.java │ │ │ ├── CharacterTableLabelTransformer.java │ │ │ ├── DelimitedTableLabelTransformer.java │ │ │ ├── TableLabelTransformer.java │ │ │ └── TableLabelTransformerFactory.java │ │ └── pds3 │ │ │ └── OrderedObjectStatement.java │ │ ├── table │ │ └── TableExtractor.java │ │ └── util │ │ ├── ImageProperties.java │ │ ├── ObjectsReport.java │ │ ├── PDS3LabelWriter.java │ │ ├── ToolInfo.java │ │ ├── Transcoder.java │ │ └── Utility.java └── resources │ ├── conf │ ├── context-classes.xml │ ├── generated-mappings.xml │ └── velocity-tools.xml │ ├── examples │ ├── 20140804T205944Z_MAP_bias_V001.fits │ ├── 20140804T205944Z_MAP_bias_V001.xml │ ├── 2d234493326edratf3d2537n0m1.dat │ ├── BA03S183.IMG │ ├── C000M5232T493378259EDR_F0000_0134M1.IMG │ ├── C000M5232T493378259EDR_F0000_0134M1.xml │ ├── ELE_MOM.LBL │ ├── ELE_MOM.TAB │ ├── FF01.IMG │ ├── FF01.LBL │ ├── FHA01118.IMG │ ├── LABEL │ │ └── PWR.FMT │ ├── N1727539187_1.IMG │ ├── N1727539187_1.LBL │ ├── PDS4_ATM_TABLE_CHAR.TAB │ ├── PDS4_ATM_TABLE_CHAR_MULTIPLE.TAB │ ├── PDS4_TABLE_DELIMITED.csv │ ├── PWR02176_01.LBL │ ├── PWR02176_01.TAB │ ├── Product_Table_Binary.xml │ ├── Product_Table_Character.xml │ ├── Product_Table_Delimited.xml │ ├── Product_Table_Multiple_Datafiles.xml │ ├── Product_Table_Multiple_Tables.xml │ ├── b0090_p243401_01_01v02.qub │ ├── b0090_p243401_01_01v02.xml │ ├── ba03s183.xml │ ├── ff01.xml │ ├── i943630r.raw │ └── i943630r.xml │ ├── external-programs │ ├── external-programs.properties │ └── python │ │ ├── coiss_data_to_pds4.py │ │ └── vicar.py │ ├── stylesheets │ ├── html-structure-only.xsl │ ├── html.xsl │ ├── pvl.xsl │ └── stylesheets.properties │ ├── templates │ ├── generic-pds3_to_pds4.vm │ └── vicar-pds3_to_pds4.vm │ └── transform.properties └── site ├── resources └── images │ ├── pds4_logo.png │ ├── windows_panel.jpg │ └── windows_search.jpg ├── site.xml └── xdoc ├── index.xml ├── install ├── index-win.xml.vm └── index.xml.vm └── operate └── index.xml.vm /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # 📀 Code Owners 2 | # 3 | # Copyright © 2021, California Institute of Technology ("Caltech"). 4 | # U.S. Government sponsorship acknowledged. 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # 11 | # • Redistributions of source code must retain the above copyright notice, 12 | # this list of conditions and the following disclaimer. 13 | # • Redistributions must reproduce the above copyright notice, this list of 14 | # conditions and the following disclaimer in the documentation and/or other 15 | # materials provided with the distribution. 16 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 17 | # Laboratory, nor the names of its contributors may be used to endorse or 18 | # promote products derived from this software without specific prior written 19 | # permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | # 33 | # 34 | # Each line is a file pattern followed by one or more owners. 35 | # 36 | # These owners will be the default owners for everything in 37 | # the repo. Unless a later match takes precedence, 38 | # @global-owner1 and @global-owner2 will be requested for 39 | # review when someone opens a pull request. 40 | # 41 | # Go to https://github.com/orgs/NASA-PDS/teams to find out about our teams 42 | 43 | * @NASA-PDS/java-committers 44 | 45 | # For more information on populating this file, check out 46 | # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners 47 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "maven" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | 13 | - package-ecosystem: "github-actions" # See documentation for possible values 14 | directory: "/" # Location of package manifests 15 | schedule: 16 | interval: "weekly" 17 | 18 | - package-ecosystem: "terraform" # See documentation for possible values 19 | directory: "/terraform/" # Location of package manifests 20 | schedule: 21 | interval: "weekly" 22 | 23 | - package-ecosystem: "docker" # See documentation for possible values 24 | directory: "/docker/" # Location of package manifests 25 | schedule: 26 | interval: "weekly" 27 | -------------------------------------------------------------------------------- /.github/workflows/branch-cicd.yaml: -------------------------------------------------------------------------------- 1 | # 🏃‍♀️ Continuous Integration and Delivery: Branch Testing 2 | # ====================================================== 3 | 4 | 5 | --- 6 | 7 | name: 🔁 Branch integration testing 8 | 9 | 10 | # Driving Event 11 | # ------------- 12 | # 13 | # What event starts this workflow: a push to any branch other than main 14 | 15 | on: 16 | push: 17 | branches: 18 | - '**' 19 | - '!main' 20 | workflow_dispatch: 21 | 22 | 23 | # What to Do 24 | # ---------- 25 | # 26 | # Test the software with mvn test 27 | 28 | jobs: 29 | branch-testing: 30 | name: 🪵 Branch Testing 31 | runs-on: ubuntu-latest 32 | if: github.actor != 'pdsen-ci' 33 | 34 | strategy: 35 | matrix: 36 | java-version: [11, 17] 37 | 38 | steps: 39 | - 40 | name: 💳 Checkout 41 | uses: actions/checkout@v4 42 | with: 43 | lfs: true 44 | fetch-depth: 0 45 | token: ${{secrets.ADMIN_GITHUB_TOKEN || github.token}} 46 | - 47 | name: 💵 Maven Cache 48 | uses: actions/cache@v4 49 | with: 50 | path: ~/.m2/repository 51 | # The "key" used to indicate a set of cached files is the operating system runner 52 | # plus "mvn" for Maven-specific builds, plus a hash of the `pom.xml` files, which 53 | # should uniquely identify the dependent jars; plus "pds" because we pds-prefix 54 | # everything with "pds" in PDS—even when the context is obvious! 😅 55 | key: pds-${{runner.os}}-mvn-${{hashFiles('**/pom.xml')}} 56 | # To restore a set of files, we only need to match a prefix of the saved key. 57 | restore-keys: pds-${{runner.os}}-mvn- 58 | - 59 | name: ☕️ Set up OpenJDK 60 | uses: actions/setup-java@v4 61 | with: 62 | distribution: 'adopt' 63 | java-version: ${{matrix.java-version}} 64 | - 65 | name: 🩺 Test Software 66 | run: mvn test 67 | 68 | ... 69 | 70 | # -*- mode: yaml; indent: 4; fill-column: 120; coding: utf-8 -*- 71 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yaml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * 0' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | analyze: 10 | name: Analyze 11 | runs-on: ubuntu-latest 12 | if: github.actor != 'pdsen-ci' 13 | 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | # Override automatic language detection by changing the below list 18 | # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] 19 | # language: ['java', 'python'] 20 | language: ['java'] 21 | # Learn more... 22 | # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | with: 28 | # We must fetch at least the immediate parents so that if this is 29 | # a pull request then we can checkout the head. 30 | fetch-depth: 2 31 | 32 | # Initializes the CodeQL tools for scanning. 33 | - name: Initialize CodeQL 34 | uses: github/codeql-action/init@v3 35 | with: 36 | languages: ${{ matrix.language }} 37 | queries: security-and-quality, security-extended 38 | 39 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 40 | # If this step fails, then you should remove it and run the build manually (see below) 41 | - name: Autobuild 42 | uses: github/codeql-action/autobuild@v3 43 | 44 | # ℹ️ Command-line programs to run using the OS shell. 45 | # 📚 https://git.io/JvXDl 46 | 47 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 48 | # and modify them (or add more) to build your code if your project 49 | # uses a compiled language 50 | 51 | # - run: | 52 | # mvn clean compile site -DskipTests 53 | 54 | - name: Perform CodeQL Analysis 55 | uses: github/codeql-action/analyze@v3 56 | 57 | - run: | 58 | pip install nasa-scrub 59 | 60 | results_dir=`realpath ${{ github.workspace }}/../results` 61 | sarif_files=`find $results_dir -name '*.sarif'` 62 | 63 | for sarif_file in $sarif_files 64 | do 65 | output_file="$results_dir/$(basename $sarif_file .sarif).scrub" 66 | 67 | python3 -m scrub.tools.parsers.translate_results $sarif_file $output_file ${{ github.workspace }} scrub 68 | done 69 | 70 | python3 -m scrub.tools.parsers.csv_parser $results_dir 71 | 72 | echo "RESULTS_DIR=$results_dir" >> $GITHUB_ENV 73 | 74 | 75 | - name: Upload CodeQL Artifacts 76 | uses: actions/upload-artifact@v4 77 | with: 78 | name: codeql-artifacts 79 | path: ${{ env.RESULTS_DIR }} 80 | 81 | 82 | sloc-count: 83 | name: SLOC Count 84 | runs-on: ubuntu-latest 85 | if: github.actor != 'pdsen-ci' 86 | steps: 87 | - 88 | name: 💳 Checkout 89 | uses: actions/checkout@v4 90 | with: 91 | lfs: true 92 | fetch-depth: 0 93 | token: ${{secrets.ADMIN_GITHUB_TOKEN}} 94 | 95 | - 96 | name: Count Lines of Code (cloc) 97 | uses: djdefi/cloc-action@6 98 | with: 99 | options: --report-file=cloc.md 100 | 101 | 102 | - 103 | name: Upload SLOC 104 | uses: actions/upload-artifact@v4 105 | with: 106 | name: sloc-count 107 | path: ${{ github.workspace }}/cloc.md 108 | -------------------------------------------------------------------------------- /.github/workflows/secrets-detection.yaml: -------------------------------------------------------------------------------- 1 | name: Secret Detection Workflow 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | secret-detection: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - 15 | name: Checkout code 16 | uses: actions/checkout@v4 17 | - 18 | name: Install necessary packages 19 | run: | 20 | pip install git+https://github.com/NASA-AMMOS/slim-detect-secrets.git@exp 21 | pip install jq 22 | 23 | - 24 | name: Create an initial .secrets.baseline if .secrets.baseline does not exist 25 | run: | 26 | if [ ! -f .secrets.baseline ]; then 27 | # This generated baseline file will only be temporarily available on the GitHub side and will not appear in the user's local files. 28 | # Scanning an empty folder to generate an initial .secrets.baseline without secrets in the results. 29 | echo "⚠️ No existing .secrets.baseline file detected. Creating a new blank baseline file." 30 | mkdir empty-dir 31 | detect-secrets scan empty-dir > .secrets.baseline 32 | echo "✅ Blank .secrets.baseline file created successfully." 33 | rm -r empty-dir 34 | else 35 | echo "✅ Existing .secrets.baseline file detected. No new baseline file will be created." 36 | fi 37 | 38 | - 39 | name: Scan repository for secrets 40 | run: | 41 | # scripts to scan repository for new secrets 42 | 43 | # backup the list of known secrets 44 | cp .secrets.baseline .secrets.new 45 | 46 | # find the secrets in the repository 47 | detect-secrets scan --disable-plugin AbsolutePathDetectorExperimental --baseline .secrets.new \ 48 | --exclude-files '\.secrets..*' \ 49 | --exclude-files '\.pre-commit-config\.yaml' \ 50 | --exclude-files '\.git.*' \ 51 | --exclude-files 'target' 52 | 53 | # if there is any difference between the known and newly detected secrets, break the build 54 | # Function to compare secrets without listing them 55 | compare_secrets() { diff <(jq -r '.results | keys[] as $key | "\($key),\(.[$key] | .[] | .hashed_secret)"' "$1" | sort) <(jq -r '.results | keys[] as $key | "\($key),\(.[$key] | .[] | .hashed_secret)"' "$2" | sort) >/dev/null; } 56 | 57 | # Check if there's any difference between the known and newly detected secrets 58 | if ! compare_secrets .secrets.baseline .secrets.new; then 59 | echo "⚠️ Attention Required! ⚠️" >&2 60 | echo "New secrets have been detected in your recent commit. Due to security concerns, we cannot display detailed information here and we cannot proceed until this issue is resolved." >&2 61 | echo "" >&2 62 | echo "Please follow the steps below on your local machine to reveal and handle the secrets:" >&2 63 | echo "" >&2 64 | echo "1️⃣ Run the 'detect-secrets' tool on your local machine. This tool will identify and clean up the secrets. You can find detailed instructions at this link: https://nasa-ammos.github.io/slim/continuous-testing/starter-kits/#detect-secrets" >&2 65 | echo "" >&2 66 | echo "2️⃣ After cleaning up the secrets, commit your changes and re-push your update to the repository." >&2 67 | echo "" >&2 68 | echo "Your efforts to maintain the security of our codebase are greatly appreciated!" >&2 69 | exit 1 70 | fi 71 | -------------------------------------------------------------------------------- /.github/workflows/stable-cicd.yaml: -------------------------------------------------------------------------------- 1 | # 🏃‍♀️ Continuous Integration and Delivery: Stable 2 | # =============================================== 3 | # 4 | # Note: for this workflow to succeed, the following secrets must be installed 5 | # in the repository: 6 | # 7 | # ``ADMIN_GITHUB_TOKEN`` 8 | # A personal access token of a user with collaborator or better access to 9 | # the project repository. You can generate this by visiting GitHub → 10 | # Settings → Developer settings → Personal access tokens → Generate new 11 | # token. Give the token scopes on ``repo``, ``write:packages``, 12 | # ``delete:packages``, ``workflow``, and ``read:gpg_key``. 13 | # ``CODE_SIGNING_KEY`` 14 | # A *private* key with which we can sign artifacts. 15 | # ``OSSRH_USERNAME`` 16 | # Username for the Central Repository. 17 | # ``OSSRH_USERNAME`` 18 | # Password for the Central Repository. 19 | # 20 | 21 | 22 | --- 23 | 24 | name: 😌 Stable integration & delivery 25 | 26 | 27 | # Driving Event 28 | # ------------- 29 | # 30 | # What event starts this workflow: a push of a release tag. Note: according to 31 | # https://git.io/JJZQt we have been doing our tag matching wrong. It's not 32 | # regexp, it's not glob…it's more like…glob++ 😮 33 | 34 | on: 35 | push: 36 | tags: 37 | - 'release/*' 38 | concurrency: roundup 39 | 40 | 41 | # What to Do 42 | # ---------- 43 | # 44 | # Round up, yee-haw! 45 | 46 | jobs: 47 | stable-assembly: 48 | name: 🐴 Stable Assembly 49 | runs-on: ubuntu-latest 50 | steps: 51 | - 52 | name: 💳 Checkout 53 | uses: actions/checkout@v4 54 | with: 55 | lfs: true 56 | token: ${{secrets.ADMIN_GITHUB_TOKEN}} 57 | fetch-depth: 0 58 | - 59 | name: 💵 Maven Cache 60 | uses: actions/cache@v4 61 | with: 62 | path: ~/.m2/repository 63 | # The "key" used to indicate a set of cached files is the operating system runner 64 | # plus "mvn" for Maven-specific builds, plus a hash of the `pom.xml` files, which 65 | # should uniquely identify the dependent jars; plus "pds" because we pds-prefix 66 | # everything with "pds" in PDS—even when the context is obvious! 😅 67 | key: pds-${{runner.os}}-mvn-${{hashFiles('**/pom.xml')}} 68 | # To restore a set of files, we only need to match a prefix of the saved key. 69 | restore-keys: pds-${{runner.os}}-mvn- 70 | - 71 | name: 🤠 Roundup 72 | uses: NASA-PDS/roundup-action@stable 73 | with: 74 | assembly: stable 75 | packages: openjdk11-jdk 76 | maven-build-phases: install 77 | maven-doc-phases: clean,site,site:stage 78 | maven-stable-artifact-phases: clean,site,site:stage,deploy 79 | documentation-dir: target/staging/transform 80 | env: 81 | ossrh_username: ${{secrets.OSSRH_USERNAME}} 82 | ossrh_password: ${{secrets.OSSRH_PASSWORD}} 83 | CODE_SIGNING_KEY: ${{secrets.CODE_SIGNING_KEY}} 84 | ADMIN_GITHUB_TOKEN: ${{secrets.ADMIN_GITHUB_TOKEN}} 85 | 86 | ... 87 | 88 | # -*- mode: yaml; indent: 4; fill-column: 120; coding: utf-8 -*- 89 | -------------------------------------------------------------------------------- /.github/workflows/unstable-cicd.yaml: -------------------------------------------------------------------------------- 1 | # 🏃‍♀️ Continuous Integration and Delivery: Unstable 2 | # ================================================= 3 | # 4 | # Note: for this workflow to succeed, the following secrets must be installed 5 | # in the repository or inherited from the organization: 6 | # 7 | # ``ADMIN_GITHUB_TOKEN`` 8 | # A personal access token of a user with collaborator or better access to 9 | # the project repository. You can generate this by visiting GitHub → 10 | # Settings → Developer settings → Personal access tokens → Generate new 11 | # token. Give the token scopes on ``repo``, ``write:packages``, 12 | # ``delete:packages``, ``workflow``, and ``read:gpg_key``. 13 | # ``CODE_SIGNING_KEY`` 14 | # A *private* key with which we can sign artifacts. 15 | # ``OSSRH_USERNAME`` 16 | # Username for the Central Repository. 17 | # ``OSSRH_USERNAME`` 18 | # Password for the Central Repository. 19 | 20 | 21 | --- 22 | 23 | name: 🤪 Unstable integration & delivery 24 | 25 | 26 | # Driving Event 27 | # ------------- 28 | # 29 | # What event starts this workflow: a push to ``main`` (or ``master`` in old 30 | # parlance). 31 | 32 | on: 33 | push: 34 | branches: 35 | - main 36 | paths-ignore: 37 | - 'CHANGELOG.md' 38 | - 'docs/requirements/**' 39 | workflow_dispatch: 40 | concurrency: roundup 41 | 42 | 43 | # What to Do 44 | # ---------- 45 | # 46 | # Round up, yee-haw! 47 | 48 | jobs: 49 | unstable-assembly: 50 | name: 🧩 Unstable Assembly 51 | runs-on: ubuntu-latest 52 | if: github.actor != 'pdsen-ci' 53 | steps: 54 | - 55 | name: 💳 Checkout 56 | uses: actions/checkout@v4 57 | with: 58 | lfs: true 59 | fetch-depth: 0 60 | token: ${{secrets.ADMIN_GITHUB_TOKEN}} 61 | - 62 | name: 💵 Maven Cache 63 | uses: actions/cache@v4 64 | with: 65 | path: ~/.m2/repository 66 | # The "key" used to indicate a set of cached files is the operating system runner 67 | # plus "mvn" for Maven-specific builds, plus a hash of the `pom.xml` files, which 68 | # should uniquely identify the dependent jars; plus "pds" because we pds-prefix 69 | # everything with "pds" in PDS—even when the context is obvious! 😅 70 | key: pds-${{runner.os}}-mvn-${{hashFiles('**/pom.xml')}} 71 | # To restore a set of files, we only need to match a prefix of the saved key. 72 | restore-keys: pds-${{runner.os}}-mvn- 73 | - 74 | name: 🤠 Roundup 75 | uses: NASA-PDS/roundup-action@stable 76 | with: 77 | assembly: unstable 78 | packages: openjdk11-jdk 79 | maven-build-phases: install 80 | maven-doc-phases: clean,site,site:stage 81 | maven-unstable-artifact-phases: clean,site,site:stage,deploy 82 | env: 83 | ossrh_username: ${{secrets.OSSRH_USERNAME}} 84 | ossrh_password: ${{secrets.OSSRH_PASSWORD}} 85 | CODE_SIGNING_KEY: ${{secrets.CODE_SIGNING_KEY}} 86 | ADMIN_GITHUB_TOKEN: ${{secrets.ADMIN_GITHUB_TOKEN}} 87 | 88 | ... 89 | 90 | # -*- mode: yaml; indent: 4; fill-column: 120; coding: utf-8 -*- 91 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.pkl 4 | *.pyc 5 | 6 | # Libraries 7 | *.lib 8 | *.a 9 | 10 | # Eclipse files 11 | .settings/ 12 | *.project 13 | *.classpath 14 | 15 | # IntelliJ files 16 | .idea/ 17 | *.iml 18 | 19 | # Shared objects (inc. Windows DLLs) 20 | *.dll 21 | *.so 22 | *.so.* 23 | *.dylib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | 30 | # Temporary files 31 | *~ 32 | src/test/temp/ 33 | 34 | # other stuff 35 | *.xpr 36 | *.swp 37 | /bin/ 38 | .*.swp 39 | *.sublime-* 40 | *.DS_Store 41 | pom.xml.versionsBackup 42 | 43 | # Java stuff 44 | *.javac 45 | .gwt/ 46 | target/ 47 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # Pre-Commit 2 | # ========== 3 | # 4 | # Pre-Commit (https://pre-commit.com/) is a framework for handling the hooks 5 | # for git to easily standardizez on linters, code-cleaners, security 6 | # scanners, etc. 7 | # 8 | # Currently for Java repositories, we support the following hooks: 9 | # 10 | # - Detect Secrets (https://nasa-ammos.github.io/slim/docs/guides/software-lifecycle/security/secrets-detection/) 11 | # 12 | # Future hooks could include: trailing whitespace alerts, executable shebangs, 13 | # debug statements left in code, Google code style adherence, etc. 14 | 15 | 16 | --- 17 | 18 | repos: 19 | - 20 | repo: https://github.com/NASA-AMMOS/slim-detect-secrets 21 | # using commit id for now, will change to tag when official version is released 22 | rev: 91e097ad4559ae6ab785c883dc5ed989202c7fbe 23 | hooks: 24 | - id: detect-secrets 25 | args: 26 | - '--baseline' 27 | - '.secrets.baseline' 28 | - --exclude-files '\.secrets..*' 29 | - --exclude-files '\.git.*' 30 | - --exclude-files '\.pre-commit-config\.yaml' 31 | - --exclude-files 'target' 32 | 33 | ... 34 | 35 | # -*- mode: YAML; tab-width: 4 -*- 36 | -------------------------------------------------------------------------------- /.secrets.baseline: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.4.0", 3 | "plugins_used": [ 4 | { 5 | "name": "ArtifactoryDetector" 6 | }, 7 | { 8 | "name": "AWSKeyDetector" 9 | }, 10 | { 11 | "name": "AWSSensitiveInfoDetectorExperimental" 12 | }, 13 | { 14 | "name": "AzureStorageKeyDetector" 15 | }, 16 | { 17 | "name": "Base64HighEntropyString", 18 | "limit": 4.5 19 | }, 20 | { 21 | "name": "BasicAuthDetector" 22 | }, 23 | { 24 | "name": "CloudantDetector" 25 | }, 26 | { 27 | "name": "DiscordBotTokenDetector" 28 | }, 29 | { 30 | "name": "EmailAddressDetector" 31 | }, 32 | { 33 | "name": "GitHubTokenDetector" 34 | }, 35 | { 36 | "name": "HexHighEntropyString", 37 | "limit": 3.0 38 | }, 39 | { 40 | "name": "IbmCloudIamDetector" 41 | }, 42 | { 43 | "name": "IbmCosHmacDetector" 44 | }, 45 | { 46 | "name": "IPPublicDetector" 47 | }, 48 | { 49 | "name": "JwtTokenDetector" 50 | }, 51 | { 52 | "name": "KeywordDetector", 53 | "keyword_exclude": "" 54 | }, 55 | { 56 | "name": "MailchimpDetector" 57 | }, 58 | { 59 | "name": "NpmDetector" 60 | }, 61 | { 62 | "name": "PrivateKeyDetector" 63 | }, 64 | { 65 | "name": "SendGridDetector" 66 | }, 67 | { 68 | "name": "SlackDetector" 69 | }, 70 | { 71 | "name": "SoftlayerDetector" 72 | }, 73 | { 74 | "name": "SquareOAuthDetector" 75 | }, 76 | { 77 | "name": "StripeDetector" 78 | }, 79 | { 80 | "name": "TwilioKeyDetector" 81 | } 82 | ], 83 | "filters_used": [ 84 | { 85 | "path": "detect_secrets.filters.allowlist.is_line_allowlisted" 86 | }, 87 | { 88 | "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies", 89 | "min_level": 2 90 | }, 91 | { 92 | "path": "detect_secrets.filters.heuristic.is_indirect_reference" 93 | }, 94 | { 95 | "path": "detect_secrets.filters.heuristic.is_likely_id_string" 96 | }, 97 | { 98 | "path": "detect_secrets.filters.heuristic.is_lock_file" 99 | }, 100 | { 101 | "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string" 102 | }, 103 | { 104 | "path": "detect_secrets.filters.heuristic.is_potential_uuid" 105 | }, 106 | { 107 | "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign" 108 | }, 109 | { 110 | "path": "detect_secrets.filters.heuristic.is_sequential_string" 111 | }, 112 | { 113 | "path": "detect_secrets.filters.heuristic.is_swagger_file" 114 | }, 115 | { 116 | "path": "detect_secrets.filters.heuristic.is_templated_secret" 117 | }, 118 | { 119 | "path": "detect_secrets.filters.regex.should_exclude_file", 120 | "pattern": [ 121 | "\\.secrets..*", 122 | "\\.git.*", 123 | "\\.pre-commit-config\\.yaml", 124 | "target" 125 | ] 126 | } 127 | ], 128 | "results": { 129 | "README.md": [ 130 | { 131 | "type": "Email Address", 132 | "filename": "README.md", 133 | "hashed_secret": "fac2dea9e49a83a2d6ee38c580d1e5358b45efa5", 134 | "is_verified": false, 135 | "line_number": 30 136 | } 137 | ], 138 | "src/changes/changes.xml": [ 139 | { 140 | "type": "Email Address", 141 | "filename": "src/changes/changes.xml", 142 | "hashed_secret": "bf1bfc3f1f5b1a63361b4c29a798ea62be348864", 143 | "is_verified": false, 144 | "line_number": 36 145 | } 146 | ], 147 | "src/site/xdoc/index.xml": [ 148 | { 149 | "type": "Email Address", 150 | "filename": "src/site/xdoc/index.xml", 151 | "hashed_secret": "bf1bfc3f1f5b1a63361b4c29a798ea62be348864", 152 | "is_verified": false, 153 | "line_number": 36 154 | }, 155 | { 156 | "type": "Email Address", 157 | "filename": "src/site/xdoc/index.xml", 158 | "hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd", 159 | "is_verified": false, 160 | "line_number": 37 161 | }, 162 | { 163 | "type": "Email Address", 164 | "filename": "src/site/xdoc/index.xml", 165 | "hashed_secret": "3a6d7aa49a8e4a2fe32a5cd0e53da9cb96bd8d29", 166 | "is_verified": false, 167 | "line_number": 58 168 | } 169 | ], 170 | "src/site/xdoc/install/index-win.xml.vm": [ 171 | { 172 | "type": "Email Address", 173 | "filename": "src/site/xdoc/install/index-win.xml.vm", 174 | "hashed_secret": "bf1bfc3f1f5b1a63361b4c29a798ea62be348864", 175 | "is_verified": false, 176 | "line_number": 36 177 | }, 178 | { 179 | "type": "Email Address", 180 | "filename": "src/site/xdoc/install/index-win.xml.vm", 181 | "hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd", 182 | "is_verified": false, 183 | "line_number": 37 184 | } 185 | ], 186 | "src/site/xdoc/install/index.xml.vm": [ 187 | { 188 | "type": "Email Address", 189 | "filename": "src/site/xdoc/install/index.xml.vm", 190 | "hashed_secret": "bf1bfc3f1f5b1a63361b4c29a798ea62be348864", 191 | "is_verified": false, 192 | "line_number": 5 193 | }, 194 | { 195 | "type": "Email Address", 196 | "filename": "src/site/xdoc/install/index.xml.vm", 197 | "hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd", 198 | "is_verified": false, 199 | "line_number": 6 200 | } 201 | ], 202 | "src/site/xdoc/operate/index.xml.vm": [ 203 | { 204 | "type": "Email Address", 205 | "filename": "src/site/xdoc/operate/index.xml.vm", 206 | "hashed_secret": "bf1bfc3f1f5b1a63361b4c29a798ea62be348864", 207 | "is_verified": false, 208 | "line_number": 36 209 | }, 210 | { 211 | "type": "Email Address", 212 | "filename": "src/site/xdoc/operate/index.xml.vm", 213 | "hashed_secret": "1ac7d6deddaec3bd29b1f559a573231d20d764fd", 214 | "is_verified": false, 215 | "line_number": 37 216 | } 217 | ] 218 | }, 219 | "generated_at": "2023-11-22T18:56:53Z" 220 | } 221 | -------------------------------------------------------------------------------- /.zenodo.json: -------------------------------------------------------------------------------- 1 | { 2 | "license" : "Apache-2.0", 3 | "communities": [{"identifier": "nasa-pds"}] 4 | } 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [v1.13.2](https://github.com/NASA-PDS/transform/tree/v1.13.2) (2024-05-27) 4 | 5 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.12.2...v1.13.2) 6 | 7 | **Defects:** 8 | 9 | - Transform failing with `java.lang.NoClassDefFoundError` on Windows [\#67](https://github.com/NASA-PDS/transform/issues/67) [[s.high](https://github.com/NASA-PDS/transform/labels/s.high)] 10 | - NoClassDefFoundError exception when transforming XML to PDS3 label [\#46](https://github.com/NASA-PDS/transform/issues/46) [[s.medium](https://github.com/NASA-PDS/transform/labels/s.medium)] 11 | 12 | ## [v1.12.2](https://github.com/NASA-PDS/transform/tree/v1.12.2) (2023-10-24) 13 | 14 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.12.0...v1.12.2) 15 | 16 | **Defects:** 17 | 18 | - Broken download link and Windows JAVA settings in installation docs [\#45](https://github.com/NASA-PDS/transform/issues/45) [[s.medium](https://github.com/NASA-PDS/transform/labels/s.medium)] 19 | 20 | ## [v1.12.0](https://github.com/NASA-PDS/transform/tree/v1.12.0) (2023-10-03) 21 | 22 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.5...v1.12.0) 23 | 24 | **Defects:** 25 | 26 | - Unable to transform from PDS3 Label to PDS4 Label with upgraded mi-label [\#36](https://github.com/NASA-PDS/transform/issues/36) [[s.medium](https://github.com/NASA-PDS/transform/labels/s.medium)] 27 | - Examples missing from tar/zip packages [\#35](https://github.com/NASA-PDS/transform/issues/35) [[s.medium](https://github.com/NASA-PDS/transform/labels/s.medium)] 28 | - \[SECURITY\] Upgrade to log4j-core/log4j-api [\#30](https://github.com/NASA-PDS/transform/issues/30) [[s.low](https://github.com/NASA-PDS/transform/labels/s.low)] 29 | 30 | ## [v1.11.5](https://github.com/NASA-PDS/transform/tree/v1.11.5) (2022-11-09) 31 | 32 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.4...v1.11.5) 33 | 34 | **Defects:** 35 | 36 | - Bad Links in Transform Tool-Installation Page [\#31](https://github.com/NASA-PDS/transform/issues/31) [[s.low](https://github.com/NASA-PDS/transform/labels/s.low)] 37 | 38 | ## [v1.11.4](https://github.com/NASA-PDS/transform/tree/v1.11.4) (2022-06-03) 39 | 40 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.3...v1.11.4) 41 | 42 | ## [v1.11.3](https://github.com/NASA-PDS/transform/tree/v1.11.3) (2022-06-02) 43 | 44 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.2...v1.11.3) 45 | 46 | ## [v1.11.2](https://github.com/NASA-PDS/transform/tree/v1.11.2) (2022-05-05) 47 | 48 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.1...v1.11.2) 49 | 50 | ## [v1.11.1](https://github.com/NASA-PDS/transform/tree/v1.11.1) (2019-12-13) 51 | 52 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.11.0...v1.11.1) 53 | 54 | ## [v1.11.0](https://github.com/NASA-PDS/transform/tree/v1.11.0) (2019-12-13) 55 | 56 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/v1.10.0...v1.11.0) 57 | 58 | **Defects:** 59 | 60 | - Remove erroneous JAR files causing command-line failure in build 1.10.0 [\#16](https://github.com/NASA-PDS/transform/issues/16) 61 | 62 | **Other closed issues:** 63 | 64 | - Update POM to use PDS Parent POM [\#18](https://github.com/NASA-PDS/transform/issues/18) 65 | - Prep operational release for Build 10a [\#10](https://github.com/NASA-PDS/transform/issues/10) 66 | 67 | ## [v1.10.0](https://github.com/NASA-PDS/transform/tree/v1.10.0) (2019-10-15) 68 | 69 | [Full Changelog](https://github.com/NASA-PDS/transform/compare/f8ee8235cc47e1ebd962299238a5246a264a8480...v1.10.0) 70 | 71 | **Other closed issues:** 72 | 73 | - Remove examples from release package [\#11](https://github.com/NASA-PDS/transform/issues/11) 74 | - Prep release candidate for Build 10a [\#9](https://github.com/NASA-PDS/transform/issues/9) 75 | - Update Maven docs to refer to Github release assets [\#8](https://github.com/NASA-PDS/transform/issues/8) 76 | 77 | 78 | 79 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Transform Tool 2 | 3 | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5756418.svg)](https://doi.org/10.5281/zenodo.5756418) [![🤪 Unstable integration & delivery](https://github.com/NASA-PDS/transform/actions/workflows/unstable-cicd.yaml/badge.svg)](https://github.com/NASA-PDS/transform/actions/workflows/unstable-cicd.yaml) [![😌 Stable integration & delivery](https://github.com/NASA-PDS/transform/actions/workflows/stable-cicd.yaml/badge.svg)](https://github.com/NASA-PDS/transform/actions/workflows/stable-cicd.yaml) 4 | 5 | Project containing software for transforming PDS3 and PDS4 labels and data products into various formats. 6 | 7 | # Documentation 8 | The documentation for the latest release of the Transform Tool, including release notes, installation and operation of the software are online at https://nasa-pds.github.io/transform/. 9 | 10 | If you would like to get the latest documentation, including any updates since the last release, you can execute the "mvn site:run" command and view the documentation locally at http://localhost:8080. 11 | 12 | # Build 13 | The software can be compiled and built with the "mvn compile" command but in order 14 | to create the JAR file, you must execute the "mvn compile jar:jar" command. 15 | 16 | In order to create a complete distribution package, execute the 17 | following commands: 18 | 19 | ``` 20 | % mvn site 21 | % mvn package 22 | ``` 23 | 24 | # Operational Release 25 | 26 | A release candidate should be created after the community has determined that a release should occur. These steps should be followed when generating a release candidate and when completing the release. 27 | 28 | ## Clone fresh repo 29 | ``` 30 | git clone git@github.com:NASA-PDS/transform.git 31 | ``` 32 | 33 | ## Update Version Numbers 34 | 35 | Update pom.xml for the release version or use the Maven Versions Plugin, e.g.: 36 | 37 | ``` 38 | # Skip this step if this is a RELEASE CANDIDATE, we will deploy as SNAPSHOT version for testing 39 | VERSION=1.10.0 40 | mvn versions:set -DnewVersion=$VERSION 41 | git add pom.xml 42 | ``` 43 | 44 | ## Update Changelog 45 | Update Changelog using [Github Changelog Generator](https://github.com/github-changelog-generator/github-changelog-generator). Note: Make sure you set `$CHANGELOG_GITHUB_TOKEN` in your `.bash_profile` or use the `--token` flag. 46 | ``` 47 | # For RELEASE CANDIDATE, set VERSION to future release version. 48 | github_changelog_generator --future-release v$VERSION 49 | 50 | # Only git add for OPERATIONAL release, but will be used later on for Github Release 51 | git add CHANGELOG.md 52 | ``` 53 | 54 | ## Commit Changes 55 | Commit changes using following template commit message: 56 | ``` 57 | # For operational release 58 | git commit -m "[RELEASE] Validate v$VERSION" 59 | 60 | # For release candidate 61 | CANDIDATE_NUM=1 62 | git commit -m "[RELEASE] Validate v${VERSION}-rc${CANDIDATE_NUM}" 63 | 64 | # Push changes to main 65 | git push -u origin main 66 | ``` 67 | 68 | ## Build and Deploy Software to [Sonatype Maven Repo](https://repo.maven.apache.org/maven2/gov/nasa/pds/). 69 | 70 | ``` 71 | # For operational release 72 | mvn clean site deploy -P release 73 | 74 | # For release candidate 75 | mvn clean site deploy 76 | ``` 77 | 78 | Note: If you have issues with GPG, be sure to make sure you've created your GPG key, sent to server, and have the following in your `~/.m2/settings.xml`: 79 | ``` 80 | 81 | 82 | 83 | true 84 | 85 | 86 | gpg 87 | KEY_NAME 88 | KEY_PASSPHRASE 89 | 90 | 91 | 92 | 93 | ``` 94 | 95 | ## Push Tagged Release 96 | ``` 97 | # For operational release 98 | git tag v${VERSION} 99 | git push --tags 100 | 101 | # For RELEASE CANDIDATE 102 | git tag v${VERSION}-SNAPSHOT 103 | git push --tags 104 | ``` 105 | 106 | ## Deploy Site to Github Pages 107 | 108 | From cloned repo: 109 | ``` 110 | git checkout gh-pages 111 | 112 | # Create specific version site 113 | mkdir -p $VERSION 114 | 115 | # Copy the over to version-specific and default sites 116 | rsync -av target/site/ $VERSION 117 | rsync -av $VERSION/* . 118 | 119 | git add . 120 | 121 | # For operational release 122 | git commit -m "Deploy v$VERSION docs" 123 | 124 | # For release candidate 125 | git commit -m "Deploy ${VERSION}-rc${CANDIDATE_NUM} docs" 126 | 127 | git push origin gh-pages 128 | ``` 129 | 130 | ## Update Versions For Development 131 | 132 | Update `pom.xml` with the next SNAPSHOT version either manually or using Github Versions Plugin. 133 | 134 | For RELEASE CANDIDATE, ignore this step. 135 | 136 | ``` 137 | git checkout main 138 | 139 | # For release candidates, skip to push changes to main 140 | VERSION=1.16.0-SNAPSHOT 141 | mvn versions:set -DnewVersion=$VERSION 142 | git add pom.xml 143 | git commit -m "Update version for $VERSION development" 144 | 145 | # Push changes to main 146 | git push -u origin main 147 | ``` 148 | 149 | ## Complete Release in Github 150 | Currently the process to create more formal release notes and attach Assets is done manually through the [Github UI](https://github.com/NASA-PDS/validate/releases/new) but should eventually be automated via script. 151 | 152 | *NOTE: Be sure to add the `tar.gz` and `zip` from the `target/` directory to the release assets, and use the CHANGELOG generated above to create the RELEASE NOTES.* 153 | 154 | # Snapshot Release 155 | 156 | Deploy software to Sonatype SNAPSHOTS Maven repo: 157 | 158 | ``` 159 | # Operational release 160 | mvn clean site deploy 161 | ``` 162 | 163 | # Maven JAR Dependency Reference 164 | 165 | ## Operational Releases 166 | https://search.maven.org/search?q=g:gov.nasa.pds%20AND%20a:validate&core=gav 167 | 168 | ## Snapshots 169 | https://oss.sonatype.org/content/repositories/snapshots/gov/nasa/pds/validate/ 170 | 171 | If you want to access snapshots, add the following to your `~/.m2/settings.xml`: 172 | ``` 173 | 174 | 175 | allow-snapshots 176 | true 177 | 178 | 179 | snapshots-repo 180 | https://oss.sonatype.org/content/repositories/snapshots 181 | false 182 | true 183 | 184 | 185 | 186 | 187 | ``` 188 | -------------------------------------------------------------------------------- /docs/requirements/v1.11.1/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.11.2/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.11.3/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.11.4/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.11.5/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.12.0/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.12.2/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.13.0/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.13.1/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/requirements/v1.13.2/REQUIREMENTS.md: -------------------------------------------------------------------------------- 1 | 2 | Requirements Summary 3 | ==================== 4 | 5 | # default 6 | 7 | ## Add support for GeoTIFF (uncompressed) to GeoTIFF (compressed) transformation ([#21](https://github.com/NASA-PDS/transform/issues/21)) 8 | 9 | 10 | This requirement is not impacted by the current version 11 | ## As a user, I would like to scale the brightness of an image for conversion to enable more usable output. ([#24](https://github.com/NASA-PDS/transform/issues/24)) 12 | 13 | 14 | This requirement is not impacted by the current version -------------------------------------------------------------------------------- /docs/transform-tool.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/docs/transform-tool.pptx -------------------------------------------------------------------------------- /docs/transform_requirements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/docs/transform_requirements.pdf -------------------------------------------------------------------------------- /src/main/assembly/tar-assembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 37 | bin 38 | 39 | 40 | tar.gz 41 | 42 | 43 | 44 | 45 | target 46 | lib 47 | 48 | *.jar 49 | 50 | 51 | *-javadoc.jar 52 | *-sources.jar 53 | *-test-sources.jar 54 | 55 | 56 | 57 | src/main/bin 58 | bin 59 | 60 | transform 61 | transform.bat 62 | 63 | 755 64 | keep 65 | 66 | 67 | target/site 68 | doc 69 | 644 70 | keep 71 | 72 | 73 | src/main/resources/external-programs 74 | external-programs 75 | 76 | *.properties 77 | 78 | 755 79 | keep 80 | 81 | 82 | src/main/resources/examples 83 | examples 84 | 85 | ** 86 | 87 | 644 88 | 89 | 90 | 91 | 92 | 93 | LICENSE.txt 94 | / 95 | 644 96 | unix 97 | 98 | 99 | 100 | 101 | 102 | lib 103 | false 104 | runtime 105 | false 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/main/assembly/zip-assembly.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 37 | bin 38 | 39 | 40 | zip 41 | 42 | 43 | 44 | 45 | target 46 | lib 47 | 48 | *.jar 49 | 50 | 51 | *-javadoc.jar 52 | *-sources.jar 53 | *-test-sources.jar 54 | 55 | 56 | 57 | src/main/bin 58 | bin 59 | 60 | transform 61 | transform.bat 62 | 63 | 755 64 | keep 65 | 66 | 67 | target/site 68 | doc 69 | 644 70 | keep 71 | 72 | 73 | src/main/resources/external-programs 74 | external-programs 75 | 76 | *.properties 77 | 78 | 755 79 | keep 80 | 81 | 82 | src/main/resources/examples 83 | examples 84 | 85 | ** 86 | 87 | 644 88 | 89 | 90 | 91 | 92 | 93 | LICENSE.txt 94 | / 95 | 644 96 | crlf 97 | 98 | 99 | 100 | 101 | 102 | lib 103 | false 104 | runtime 105 | false 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /src/main/bin/transform: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright © 2019, California Institute of Technology ("Caltech"). 3 | # U.S. Government sponsorship acknowledged. 4 | # 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without 8 | # modification, are permitted provided that the following conditions are met: 9 | # 10 | # • Redistributions of source code must retain the above copyright notice, 11 | # this list of conditions and the following disclaimer. 12 | # • Redistributions must reproduce the above copyright notice, this list of 13 | # conditions and the following disclaimer in the documentation and/or other 14 | # materials provided with the distribution. 15 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 16 | # Laboratory, nor the names of its contributors may be used to endorse or 17 | # promote products derived from this software without specific prior written 18 | # permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | # POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # Bourne Shell script that allows easy execution of the Transform Tool 33 | # without the need to set the CLASSPATH or having to type in that 34 | # long java command (java gov.nasa.pds.transform.TransformLauncher ...) 35 | 36 | # Expects the Transform Tool jar file to be in the ../lib directory. 37 | 38 | # Check if the JAVA_HOME environment variable is set. 39 | if [ -z "${JAVA_HOME}" ]; then 40 | JAVA_CMD=`which java` 41 | if [ $? -ne 0 ]; then 42 | echo "JAVA_HOME is not set as an environment variable" 43 | exit 1 44 | fi 45 | else 46 | JAVA_CMD="${JAVA_HOME}"/bin/java 47 | fi 48 | 49 | # Setup environment variables. 50 | SCRIPT_DIR=`dirname $0` 51 | PARENT_DIR=`cd ${SCRIPT_DIR}/.. && pwd` 52 | LIB_DIR=${PARENT_DIR}/lib 53 | 54 | # Check for dependencies. 55 | if [ ! -f ${LIB_DIR}/transform-*.jar ]; then 56 | echo "Cannot find Transform Tool jar file in ${LIB_DIR}" 1>&2 57 | exit 1 58 | fi 59 | 60 | # Finds the jar file in LIB_DIR and sets it to TRANSFORM_JAR. 61 | TRANSFORM_JAR=`ls ${LIB_DIR}/transform-*.jar` 62 | 63 | # Executes Transform Tool via the executable jar file 64 | # Arguments are passed in to the tool via '$@' 65 | ${JAVA_CMD} -Xms256m -Xmx1024m -Dcom.sun.media.jai.disableMediaLib=true -Doverwrite.output=true -Dexternal.programs.home=${PARENT_DIR}/external-programs -jar ${TRANSFORM_JAR} "$@" 66 | -------------------------------------------------------------------------------- /src/main/bin/transform.bat: -------------------------------------------------------------------------------- 1 | :: Copyright © 2019, California Institute of Technology ("Caltech"). 2 | :: U.S. Government sponsorship acknowledged. 3 | :: 4 | :: All rights reserved. 5 | :: 6 | :: Redistribution and use in source and binary forms, with or without 7 | :: modification, are permitted provided that the following conditions are met: 8 | :: 9 | :: • Redistributions of source code must retain the above copyright notice, 10 | :: this list of conditions and the following disclaimer. 11 | :: • Redistributions must reproduce the above copyright notice, this list of 12 | :: conditions and the following disclaimer in the documentation and/or other 13 | :: materials provided with the distribution. 14 | :: • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | :: Laboratory, nor the names of its contributors may be used to endorse or 16 | :: promote products derived from this software without specific prior written 17 | :: permission. 18 | :: 19 | :: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | :: AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | :: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | :: ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | :: LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | :: CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | :: SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | :: INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | :: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | :: ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | :: POSSIBILITY OF SUCH DAMAGE. 30 | 31 | :: Batch file that allows easy execution of the Transform Tool 32 | :: without the need to set the CLASSPATH or having to type in that long java 33 | :: command (java gov.nasa.pds.transform.TransformLauncher ...) 34 | 35 | :: Expects the Transform Tool jar file to be located in the ../lib directory. 36 | 37 | @echo off 38 | 39 | :: Check if the JAVA_HOME environment variable is set. 40 | if not defined JAVA_HOME ( 41 | echo The JAVA_HOME environment variable is not set. 42 | goto END 43 | ) 44 | 45 | :: Setup environment variables. 46 | set SCRIPT_DIR=%~dps0 47 | set PARENT_DIR=%SCRIPT_DIR%.. 48 | set LIB_DIR=%PARENT_DIR%\lib 49 | 50 | :: Check for dependencies. 51 | if exist "%LIB_DIR%\transform-*.jar" ( 52 | set TRANSFORM_JAR=%LIB_DIR%\transform-*.jar 53 | ) else ( 54 | echo Cannot find Transform Tool jar file in %LIB_DIR% 55 | goto END 56 | ) 57 | 58 | :: Finds the jar file in LIB_DIR and sets it to TRANSFORM_JAR 59 | for %%i in ("%LIB_DIR%"\transform-*.jar) do set TRANSFORM_JAR=%%i 60 | 61 | :: Executes the Transform Tool via the executable jar file 62 | :: The special variable '%*' allows the arguments 63 | :: to be passed into the executable. 64 | "%JAVA_HOME%"\bin\java -Xms256m -Xmx1024m -Dcom.sun.media.jai.disableMediaLib=true -Doverwrite.output=true -Dexternal.programs.home=%PARENT_DIR%\external-programs -jar "%TRANSFORM_JAR%" %* 65 | 66 | :END 67 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/TransformException.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform; 32 | 33 | public class TransformException extends Exception { 34 | /** 35 | * 36 | */ 37 | private static final long serialVersionUID = 7420562837909652451L; 38 | 39 | public TransformException(String message) { 40 | super(message); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/commandline/options/InvalidOptionException.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.commandline.options; 32 | 33 | /** 34 | * Exception class that is called upon errors found during command-line 35 | * option processing. 36 | * 37 | * 38 | * @author mcayanan 39 | * 40 | */ 41 | public class InvalidOptionException extends Exception { 42 | /** Generated serial ID. */ 43 | private static final long serialVersionUID = -5439038812448365813L; 44 | 45 | /** 46 | * Constructor. 47 | * 48 | * @param msg An exception message. 49 | */ 50 | public InvalidOptionException(String msg) { 51 | super(msg); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/ToolsLevel.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging; 32 | 33 | import java.util.logging.Level; 34 | 35 | /** 36 | * Class to hold the logging levels. 37 | * 38 | * @author mcayanan 39 | * 40 | */ 41 | public class ToolsLevel extends Level { 42 | public static final Level CONFIGURATION = new ToolsLevel("CONFIGURATION", 43 | Level.SEVERE.intValue() + 8); 44 | public static final Level SKIP = new ToolsLevel("SKIP", 45 | Level.SEVERE.intValue() + 6); 46 | public static final Level ERROR = new ToolsLevel("ERROR", 47 | Level.SEVERE.intValue() + 4); 48 | public static final Level SUCCESS = new ToolsLevel("SUCCESS", 49 | Level.SEVERE.intValue() + 3); 50 | public static final Level NOTIFICATION = new ToolsLevel("NOTIFICATION", 51 | Level.SEVERE.intValue() + 1); 52 | public static final Level DEBUG = new ToolsLevel("DEBUG", 53 | Level.CONFIG.intValue() + 1); 54 | 55 | 56 | protected ToolsLevel(String name, int value) { 57 | super(name, value); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/ToolsLogRecord.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging; 32 | 33 | import java.io.File; 34 | import java.util.logging.Level; 35 | import java.util.logging.LogRecord; 36 | 37 | /** 38 | * Class that represents a message record in the logger. 39 | * 40 | * @author mcayanan 41 | * 42 | */ 43 | public class ToolsLogRecord extends LogRecord { 44 | private String filename; 45 | private int line; 46 | 47 | public ToolsLogRecord(Level level, String message) { 48 | this(level, message, null, -1); 49 | } 50 | 51 | public ToolsLogRecord(Level level, File filename) { 52 | this(level, "", filename.toString(), -1); 53 | } 54 | 55 | public ToolsLogRecord(Level level, String message, String filename) { 56 | this(level, message, filename, -1); 57 | } 58 | 59 | public ToolsLogRecord(Level level, String message, File filename) { 60 | this(level, message, filename.toString(), -1); 61 | } 62 | 63 | public ToolsLogRecord(Level level, String message, String filename, 64 | int line) { 65 | super(level, message); 66 | this.filename = filename; 67 | this.line = line; 68 | } 69 | 70 | public String getFilename() { 71 | return filename; 72 | } 73 | 74 | public int getLine() { 75 | return line; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/filter/ToolsLogFilter.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging.filter; 32 | 33 | import java.util.logging.Filter; 34 | import java.util.logging.LogRecord; 35 | 36 | /** 37 | * Class to filter logging messages that are coming from the underlying 38 | * framework. 39 | * 40 | * @author mcayanan 41 | * 42 | */ 43 | public class ToolsLogFilter implements Filter { 44 | /** 45 | * Method that checks if a log record is loggable. 46 | * 47 | * @param record The LogRecord. 48 | * 49 | * @return true if the record can be logged by the handler. 50 | * 51 | */ 52 | @Override 53 | public boolean isLoggable(LogRecord record) { 54 | // String arcPds = "gov.nasa.arc"; 55 | String jaxb = "javax.xml.bind"; 56 | String comSunXmlInternal = "com.sun.xml.internal.bind"; 57 | String comSunXmlBind = "com.sun.xml.bind"; 58 | if ((record.getLoggerName() != null) 59 | && (record.getLoggerName().contains(jaxb) 60 | || record.getLoggerName().contains(comSunXmlInternal) 61 | || record.getLoggerName().contains(comSunXmlBind) 62 | )) { 63 | return false; 64 | } else { 65 | return true; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/format/TransformFormatter.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging.format; 32 | 33 | import gov.nasa.pds.transform.logging.ToolsLevel; 34 | import gov.nasa.pds.transform.logging.ToolsLogRecord; 35 | 36 | import java.util.logging.Formatter; 37 | import java.util.logging.Handler; 38 | import java.util.logging.Level; 39 | import java.util.logging.LogRecord; 40 | 41 | /** 42 | * Class that formats the Harvest logging messages. 43 | * 44 | * @author mcayanan 45 | * 46 | */ 47 | public class TransformFormatter extends Formatter { 48 | private static String lineFeed = System.getProperty("line.separator", "\n"); 49 | private static String doubleLineFeed = lineFeed + lineFeed; 50 | 51 | private StringBuffer config; 52 | private StringBuffer summary; 53 | 54 | private int numWarnings; 55 | 56 | private int numErrors; 57 | 58 | public TransformFormatter() { 59 | config = new StringBuffer("PDS Transform Tool Log" + doubleLineFeed); 60 | summary = new StringBuffer("Summary:" + doubleLineFeed); 61 | numWarnings = 0; 62 | numErrors = 0; 63 | } 64 | 65 | public String format(LogRecord record) { 66 | StringBuffer message = new StringBuffer(); 67 | if (record instanceof ToolsLogRecord) { 68 | ToolsLogRecord tlr = (ToolsLogRecord) record; 69 | if (tlr.getLevel().intValue() == ToolsLevel.NOTIFICATION.intValue()) { 70 | return tlr.getMessage() + lineFeed; 71 | } 72 | if (tlr.getLevel().intValue() == ToolsLevel.WARNING.intValue()) { 73 | ++numWarnings; 74 | } else if (tlr.getLevel().intValue() == ToolsLevel.SEVERE.intValue()) { 75 | ++numErrors; 76 | } 77 | if (tlr.getLevel().intValue() != ToolsLevel.CONFIGURATION.intValue()) { 78 | if (tlr.getLevel().intValue() == ToolsLevel.SEVERE.intValue()) { 79 | message.append("ERROR"); 80 | } else { 81 | message.append(tlr.getLevel().getName()); 82 | } 83 | message.append(": "); 84 | } 85 | if (tlr.getFilename() != null) { 86 | message.append("[" + tlr.getFilename() + "] "); 87 | } 88 | if (tlr.getLine() != -1) { 89 | message.append("line " + tlr.getLine() + ": "); 90 | } 91 | message.append(tlr.getMessage()); 92 | message.append(lineFeed); 93 | 94 | return message.toString(); 95 | } else { 96 | if (record.getLevel().intValue() == Level.WARNING.intValue()) { 97 | ++numWarnings; 98 | } else if (record.getLevel().intValue() == Level.SEVERE.intValue()) { 99 | ++numErrors; 100 | } 101 | if (record.getLevel().intValue() == Level.SEVERE.intValue()) { 102 | message.append("ERROR"); 103 | } else { 104 | message.append(record.getLevel().getName()); 105 | } 106 | message.append(": "); 107 | String source = record.getSourceClassName(); 108 | String tokens[] = source.split("\\."); 109 | message.append("[" + tokens[tokens.length-1] + ":" + record.getSourceMethodName() + "] "); 110 | message.append(record.getMessage()); 111 | message.append(lineFeed); 112 | return message.toString(); 113 | } 114 | } 115 | 116 | public String getTail(Handler handler) { 117 | StringBuffer report = new StringBuffer("\n"); 118 | return report.toString(); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/handler/TransformFileHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging.handler; 32 | 33 | import gov.nasa.pds.transform.logging.filter.ToolsLogFilter; 34 | 35 | import java.io.IOException; 36 | import java.util.logging.FileHandler; 37 | import java.util.logging.Formatter; 38 | import java.util.logging.Level; 39 | 40 | /** 41 | * Class to setup a file handler for the tools logging capability. 42 | * 43 | * @author mcayanan 44 | * 45 | */ 46 | public class TransformFileHandler extends FileHandler { 47 | 48 | /** 49 | * Constructor that does not append to a file and automatically 50 | * sets the log level to 'ALL'. 51 | * 52 | * @param file A file name to store the logging messages. If the file 53 | * exists, it will overwrite the existing contents. 54 | * @param formatter Formatter to be used to format the log messages. 55 | * 56 | * @throws SecurityException 57 | * @throws IOException 58 | */ 59 | public TransformFileHandler(String file, Formatter formatter) 60 | throws SecurityException, IOException { 61 | this(file, false, Level.ALL, formatter); 62 | } 63 | 64 | /** 65 | * Constructor that does not append to a file. 66 | * 67 | * @param file A file name to store the logging messages. 68 | * @param level Sets the logging level. 69 | * @param formatter Formatter to be used to format the log messages. 70 | * 71 | * @throws SecurityException 72 | * @throws IOException 73 | */ 74 | public TransformFileHandler(String file, Level level, Formatter formatter) 75 | throws SecurityException, IOException { 76 | this(file, false, level, formatter); 77 | } 78 | 79 | /** 80 | * Constructor. 81 | * 82 | * @param file A file name to store the logging messages. 83 | * @param append A flag to tell the handler to append to the file or 84 | * to overwrite the existing contents. 85 | * @param level Sets the logging level. 86 | * @param formatter Formatter to be used to format the log messages. 87 | * 88 | * @throws SecurityException 89 | * @throws IOException 90 | */ 91 | public TransformFileHandler(String file, boolean append, Level level, 92 | Formatter formatter) throws SecurityException, IOException { 93 | super(file, append); 94 | setLevel(level); 95 | setFormatter(formatter); 96 | setFilter(new ToolsLogFilter()); 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/logging/handler/TransformStreamHandler.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.logging.handler; 32 | 33 | import gov.nasa.pds.transform.logging.filter.ToolsLogFilter; 34 | 35 | import java.io.OutputStream; 36 | import java.util.logging.Formatter; 37 | import java.util.logging.Level; 38 | import java.util.logging.StreamHandler; 39 | 40 | /** 41 | * This class sets up a stream handler for the tools logging capability. 42 | * 43 | * @author mcayanan 44 | * 45 | */ 46 | public class TransformStreamHandler extends StreamHandler { 47 | 48 | /** 49 | * Constructor. Automatically sets the log level to 'ALL'. 50 | * 51 | * @param out An output stream. 52 | * @param formatter Formatter to be used to format the log messages. 53 | */ 54 | public TransformStreamHandler(OutputStream out, Formatter formatter) { 55 | this(out, Level.ALL, formatter); 56 | } 57 | 58 | /** 59 | * Constructor. 60 | * @param out An output stream. 61 | * @param level Sets the log level, specifying which message levels will 62 | * be logged by this handler. 63 | * @param formatter Formatter to be used to format the log messages. 64 | */ 65 | public TransformStreamHandler(OutputStream out, Level level, 66 | Formatter formatter) { 67 | super(out, formatter); 68 | setLevel(level); 69 | setFilter(new ToolsLogFilter()); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/DefaultTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product; 32 | 33 | import gov.nasa.pds.transform.TransformException; 34 | import gov.nasa.pds.transform.TransformLauncher; 35 | import gov.nasa.pds.transform.logging.ToolsLevel; 36 | import gov.nasa.pds.transform.logging.ToolsLogRecord; 37 | 38 | import java.io.File; 39 | import java.util.ArrayList; 40 | import java.util.List; 41 | import java.util.logging.Logger; 42 | import java.net.URL; 43 | import java.net.URISyntaxException; 44 | 45 | /** 46 | * Default implementation of the ProductTransformer interface. 47 | * 48 | * @author mcayanan 49 | * 50 | */ 51 | public abstract class DefaultTransformer implements ProductTransformer { 52 | /** logger object. */ 53 | protected static Logger log = Logger.getLogger( 54 | TransformLauncher.class.getName()); 55 | 56 | /** 57 | * Flag to indicate whether to overwrite an existing output file. 58 | */ 59 | protected boolean overwriteOutput; 60 | 61 | protected boolean appendIndexToOutputFile; 62 | 63 | /** 64 | * Default constructor. Sets the flag to overwrite outputs to 65 | * true. 66 | * 67 | */ 68 | public DefaultTransformer() { 69 | this(true); 70 | appendIndexToOutputFile = false; 71 | } 72 | 73 | /** 74 | * Constructor to set the flag to overwrite outputs. 75 | * 76 | * @param overwrite Set to true to overwrite outputs, false otherwise. 77 | */ 78 | public DefaultTransformer(boolean overwrite) { 79 | this.overwriteOutput = overwrite; 80 | } 81 | 82 | @Override 83 | public List transform(File target, File outputDir, String format) 84 | throws TransformException { 85 | try { 86 | return transform(target.toURI().toURL(), outputDir, format); 87 | } catch (Exception e) { 88 | throw new TransformException(e.getMessage()); 89 | } 90 | /* 91 | List results = new ArrayList(); 92 | try { 93 | results = transform(target, outputDir, format, "", 1); 94 | } catch (TransformException te) { 95 | log.log(new ToolsLogRecord(ToolsLevel.SEVERE, te.getMessage(), target)); 96 | } 97 | return results; 98 | */ 99 | } 100 | 101 | @Override 102 | public List transform(URL url, File outputDir, String format) 103 | throws TransformException, URISyntaxException, Exception { 104 | List results = new ArrayList(); 105 | try { 106 | results = transform(url, outputDir, format, "", 1); 107 | } catch (TransformException te) { 108 | log.log(new ToolsLogRecord(ToolsLevel.SEVERE, te.getMessage(), url.toString())); 109 | } 110 | return results; 111 | } 112 | 113 | public List transform(File target, File outputDir, String format, 114 | String dataFile, int index) throws TransformException { 115 | try { 116 | return transform(target.toURI().toURL(), outputDir, format, dataFile, index); 117 | } catch (Exception e) { 118 | throw new TransformException(e.getMessage()); 119 | } 120 | } 121 | 122 | public abstract List transform(URL url, File outputDir, String format, 123 | String dataFile, int index) throws TransformException, URISyntaxException, Exception; 124 | 125 | @Override 126 | public List transform(List targets, File outputDir, String format) 127 | throws TransformException, URISyntaxException, Exception { 128 | List results = new ArrayList(); 129 | for (URL target : targets) { 130 | try { 131 | results.addAll(transform(target, outputDir, format)); 132 | } catch (TransformException te) { 133 | log.log(new ToolsLogRecord(ToolsLevel.SEVERE, te.getMessage(), target.toString())); 134 | } 135 | } 136 | return results; 137 | } 138 | 139 | @Override 140 | public List transformAll(File target, File outputDir, String format) 141 | throws TransformException { 142 | try { 143 | return transformAll(target.toURI().toURL(), outputDir, format); 144 | } catch (Exception e) { 145 | throw new TransformException(e.getMessage()); 146 | } 147 | } 148 | 149 | @Override 150 | public abstract List transformAll(URL url, File outputDir, String format) 151 | throws TransformException, URISyntaxException, Exception; 152 | 153 | public List transformAll(List targets, File outputDir, 154 | String format) throws TransformException, URISyntaxException, Exception { 155 | List results = new ArrayList(); 156 | for (URL target : targets) { 157 | try { 158 | results.addAll(transformAll(target, outputDir, format)); 159 | } catch (TransformException te) { 160 | log.log(new ToolsLogRecord(ToolsLevel.SEVERE, te.getMessage(), target.toString())); 161 | } 162 | } 163 | return results; 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/Pds3LabelTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product; 32 | 33 | import gov.nasa.pds.transform.TransformException; 34 | import gov.nasa.pds.transform.logging.ToolsLevel; 35 | import gov.nasa.pds.transform.logging.ToolsLogRecord; 36 | import gov.nasa.pds.transform.util.Utility; 37 | 38 | import java.io.File; 39 | import java.util.ArrayList; 40 | import java.util.Arrays; 41 | import java.util.List; 42 | import java.net.URL; 43 | import java.net.URISyntaxException; 44 | 45 | /** 46 | * Class to support transformations given a PDS3 label. 47 | * 48 | * @author mcayanan 49 | * 50 | */ 51 | public class Pds3LabelTransformer extends DefaultTransformer { 52 | 53 | private List includePaths; 54 | 55 | /** 56 | * Constructor to set the flag to overwrite outputs. 57 | * 58 | * @param overwrite Set to true to overwrite outputs, false otherwise. 59 | */ 60 | public Pds3LabelTransformer(boolean overwrite) { 61 | super(overwrite); 62 | includePaths = new ArrayList(); 63 | } 64 | 65 | public List transform(URL url, File outputDir, String format) 66 | throws TransformException, URISyntaxException, Exception { 67 | File target = null; 68 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 69 | "Transforming label file: " + url.toString(), url.toString())); 70 | File outputFile = Utility.createOutputFile(new File(url.getFile()), outputDir, format); 71 | if ((outputFile.exists() && outputFile.length() != 0) && !overwriteOutput) { 72 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 73 | "Output file already exists. No transformation will occur: " 74 | + outputFile.toString(), url.toString())); 75 | return Arrays.asList(outputFile); 76 | } 77 | 78 | if (url.getProtocol().startsWith("http")) { 79 | target = Utility.getFileFromURL(url, outputDir); 80 | } 81 | else target = new File(url.toURI()); 82 | try { 83 | Utility.generate(target, outputFile, "generic-pds3_to_pds4.vm", includePaths); 84 | } catch (Exception e) { 85 | throw new TransformException("Error occurred while generating " 86 | + "PDS4 label: " + e.getMessage()); 87 | } 88 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 89 | "Finished transforming PDS3 label '" + url.toString() 90 | + "' to a PDS4 label '" + outputFile + "'", url.toString())); 91 | return Arrays.asList(outputFile); 92 | } 93 | 94 | @Override 95 | public List transform(File target, File outputDir, String format) 96 | throws TransformException { 97 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 98 | "Transforming label file: " + target, target)); 99 | File outputFile = Utility.createOutputFile(target, outputDir, format); 100 | if ((outputFile.exists() && outputFile.length() != 0) && !overwriteOutput) { 101 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 102 | "Output file already exists. No transformation will occur: " 103 | + outputFile.toString(), target)); 104 | return Arrays.asList(outputFile); 105 | } 106 | try { 107 | Utility.generate(target, outputFile, "generic-pds3_to_pds4.vm", includePaths); 108 | } catch (Exception e) { 109 | throw new TransformException("Error occurred while generating " 110 | + "PDS4 label: " + e.getMessage()); 111 | } 112 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 113 | "Finished transforming PDS3 label '" + target 114 | + "' to a PDS4 label '" + outputFile + "'", target)); 115 | return Arrays.asList(outputFile); 116 | } 117 | 118 | @Override 119 | public List transform(File target, File outputDir, String format, 120 | String dataFile, int index) throws TransformException { 121 | return transform(target, outputDir, format); 122 | } 123 | 124 | @Override 125 | public List transform(URL url, File outputDir, String format, String dataFile, int index) 126 | throws TransformException, URISyntaxException, Exception { 127 | return transform(url, outputDir, format); 128 | } 129 | 130 | @Override 131 | public List transformAll(File target, File outputDir, String format) 132 | throws TransformException { 133 | List outputs = new ArrayList(); 134 | outputs.addAll(transform(target, outputDir, format)); 135 | return outputs; 136 | } 137 | 138 | @Override 139 | public List transformAll(URL url, File outputDir, String format) 140 | throws TransformException, URISyntaxException, Exception { 141 | List outputs = new ArrayList(); 142 | outputs.addAll(transform(url, outputDir, format)); 143 | return outputs; 144 | } 145 | 146 | /** 147 | * Set the paths to search for files referenced by pointers. 148 | *

149 | * Default is to always look first in the same directory 150 | * as the label, then search specified directories. 151 | * @param i List of paths 152 | */ 153 | public void setIncludePaths(List i) { 154 | this.includePaths = new ArrayList (i); 155 | while(this.includePaths.remove("")); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/Pds4LabelTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product; 32 | 33 | import java.io.File; 34 | import java.io.IOException; 35 | import java.util.ArrayList; 36 | import java.util.Arrays; 37 | import java.util.List; 38 | import java.net.URL; 39 | import java.net.URISyntaxException; 40 | 41 | import gov.nasa.pds.tools.label.Label; 42 | import gov.nasa.pds.transform.TransformException; 43 | import gov.nasa.pds.transform.logging.ToolsLevel; 44 | import gov.nasa.pds.transform.logging.ToolsLogRecord; 45 | import gov.nasa.pds.transform.util.PDS3LabelWriter; 46 | import gov.nasa.pds.transform.util.Utility; 47 | 48 | /** 49 | * Class that performs transformations on a PDS4 label. 50 | * 51 | * @author mcayanan 52 | * 53 | */ 54 | public class Pds4LabelTransformer extends DefaultTransformer { 55 | 56 | /** 57 | * Constructor. 58 | * 59 | * @param overwrite Flag to allow overwriting of the output file. 60 | */ 61 | public Pds4LabelTransformer(boolean overwrite) { 62 | super(overwrite); 63 | } 64 | 65 | @Override 66 | public List transform(URL url, File outputDir, String format, 67 | String dataFile, int index) throws TransformException, URISyntaxException, Exception { 68 | File target = new File(url.toURI()); 69 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 70 | "Transforming label file: " + url.toString(), url.toString())); 71 | 72 | File outputFile = Utility.createOutputFile(new File(url.getFile()), outputDir, format); 73 | Pds4ToPds3LabelTransformer transformer = new Pds4ToPds3LabelTransformer(outputFile); 74 | if ((outputFile.exists() && outputFile.length() != 0) && !overwriteOutput) { 75 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 76 | "Output file already exists. No transformation will occur: " 77 | + outputFile.toString(), target)); 78 | return Arrays.asList(outputFile); 79 | } 80 | try { 81 | Label label = transformer.transform(target); 82 | PDS3LabelWriter writer = new PDS3LabelWriter(); 83 | writer.write(label); 84 | log.log(new ToolsLogRecord(ToolsLevel.INFO, 85 | "Successfully transformed target label to a PDS3 label: " + outputFile.toString(), 86 | target)); 87 | return Arrays.asList(label.getLabelFile()); 88 | } catch (TransformException t) { 89 | t.printStackTrace(); 90 | throw t; 91 | } catch (IOException io) { 92 | throw new TransformException("Error while writing label to a file: " + io.getMessage()); 93 | } 94 | } 95 | 96 | @Override 97 | public List transformAll(URL url, File outputDir, String format) 98 | throws TransformException, URISyntaxException, Exception { 99 | List outputs = new ArrayList(); 100 | outputs.addAll(transform(url, outputDir, format)); 101 | return outputs; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/ProductTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product; 32 | 33 | import gov.nasa.pds.transform.TransformException; 34 | 35 | import java.io.File; 36 | import java.util.List; 37 | import java.net.URL; 38 | import java.net.URISyntaxException; 39 | 40 | 41 | /** 42 | * Interface to perform transformations on PDS data products. 43 | * 44 | * @author mcayanan 45 | * 46 | */ 47 | public interface ProductTransformer { 48 | 49 | /** 50 | * Transform a single target. This will transform 51 | * the first image/table found within the first data file found. 52 | * 53 | * @param target file specification to the PDS label. 54 | * @param outputDir directory where the output file will be 55 | * written. 56 | * @param format Valid format file type. 57 | * 58 | * @return The resulting output file. 59 | * 60 | * @throws TransformException If an error occurred during the 61 | * transformation process. 62 | */ 63 | public List transform(File target, File outputDir, String format) 64 | throws TransformException; 65 | 66 | public List transform(URL url, File outputDir, String format) 67 | throws TransformException, URISyntaxException, Exception; 68 | 69 | /** 70 | * Transform a single target. 71 | * 72 | * @param target file specification to the PDS label. 73 | * @param outputDir directory where the output file will be written. 74 | * @param format Valid format file type. 75 | * @param dataFile Tells the tool which data file to transform. 76 | * If this argument is an empty string, the default is to transform 77 | * the first data file found in the label. 78 | * @param index The index of the data. This tells the tool which image 79 | * or table to transform if there are multiple images/tables within a 80 | * single data file. 81 | * 82 | * @return The resulting output file. 83 | * 84 | * @throws TransformException If an error occurred during the 85 | * transformation process. 86 | */ 87 | public List transform(File target, File outputDir, String format, 88 | String dataFile, int index) throws TransformException; 89 | 90 | public List transform(URL target, File outputDir, String format, 91 | String dataFile, int index) 92 | throws TransformException, URISyntaxException, Exception; 93 | 94 | /** 95 | * Transform multiple targets. This will transform 96 | * the first image/table found within the first data file found in 97 | * each target. 98 | * 99 | * @param targets a list of URL specifications to the PDS labels. 100 | * @param outputDir directory where the output file will be 101 | * written. 102 | * @param format Valid format file type. 103 | * 104 | * @return The resulting output files. 105 | * 106 | * @throws TransformException If an error occurred during the 107 | * transformation process. 108 | */ 109 | public List transform(List targets, File outputDir, String format) 110 | throws TransformException, URISyntaxException, Exception; 111 | 112 | 113 | /** 114 | * Transform all images/tables found in the given target. 115 | * 116 | * @param target file specification to the PDS label. 117 | * @param outputDir directory where the output file will be written. 118 | * @param format Valid format file type. 119 | * 120 | * @return The resulting output files. 121 | * 122 | * @throws TransformException If an error occurred during the 123 | * transformation process. 124 | */ 125 | public List transformAll(File target, File outputDir, String format) 126 | throws TransformException; 127 | 128 | public List transformAll(URL url, File outputDir, String format) 129 | throws TransformException, URISyntaxException, Exception; 130 | 131 | /** 132 | * Transform all images/tables found in each target. 133 | * 134 | * @param targets a list of URL specifications to the PDS labels. 135 | * @param outputDir directory where the output file will be written. 136 | * @param format Valid format file type. 137 | * 138 | * @return The resulting output files. 139 | * 140 | * @throws TransformException If an error occurred during the 141 | * transformation process. 142 | */ 143 | public List transformAll(List targets, File outputDir, String format) 144 | throws TransformException, URISyntaxException, Exception; 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/ProductTransformerFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product; 32 | 33 | import gov.nasa.pds.transform.TransformException; 34 | import gov.nasa.pds.transform.constants.Constants; 35 | 36 | import java.io.File; 37 | import java.net.URL; 38 | 39 | import org.apache.commons.io.FilenameUtils; 40 | 41 | /** 42 | * Transformer Factory class that determines whether to transform a 43 | * PDS3 or PDS4 product. 44 | * 45 | * @author mcayanan 46 | * 47 | */ 48 | public class ProductTransformerFactory { 49 | /** Holds the factory object. */ 50 | private static ProductTransformerFactory factory = null; 51 | 52 | /** Private constructor. */ 53 | private ProductTransformerFactory() {} 54 | 55 | private final String OVERWRITE_PROP = "overwrite.output"; 56 | 57 | /** Gets an instance of the factory. 58 | * 59 | */ 60 | public static synchronized ProductTransformerFactory getInstance() { 61 | if (factory == null) { 62 | factory = new ProductTransformerFactory(); 63 | } 64 | return factory; 65 | } 66 | 67 | /** 68 | * Gets an instance of a Transformer. If the given label ends in ".xml", 69 | * then this will return a PDS4 Transformer object. Otherwise, a PDS3 70 | * Transformer object will be returned. 71 | * 72 | * @param target A PDS3 or PDS4 label file. 73 | * @param format The transformation format. 74 | * 75 | * @return The appropriate Transformer object. 76 | * 77 | * @throws TransformException If the input label could not be opened or 78 | * the format type is not one of the valid formats. 79 | */ 80 | public ProductTransformer newInstance(File target, String format) 81 | throws TransformException { 82 | if (!target.exists()) { 83 | throw new TransformException("Target not found: " + target); 84 | } 85 | boolean overwrite = Boolean.parseBoolean( 86 | System.getProperty(OVERWRITE_PROP)); 87 | String extension = FilenameUtils.getExtension(target.toString()); 88 | if (extension.equalsIgnoreCase("xml")) { 89 | if (Constants.PDS4_VALID_FORMATS.contains(format)) { 90 | if ("csv".equals(format)) { 91 | return new Pds4TableTransformer(overwrite); 92 | } else if (Constants.STYLESHEETS.containsKey(format)) { 93 | return new StylesheetTransformer(overwrite); 94 | } else if ("pds3-label".equals(format)) { 95 | return new Pds4LabelTransformer(overwrite); 96 | } else { 97 | return new Pds4ImageTransformer(overwrite); 98 | } 99 | } else { 100 | throw new TransformException("Format value '" + format 101 | + "' is not one of the valid formats for a PDS4 transformation: " 102 | + Constants.PDS4_VALID_FORMATS); 103 | } 104 | } else { 105 | if (Constants.PDS3_VALID_FORMATS.contains(format)) { 106 | if ("pds4-label".equals(format)) { 107 | return new Pds3LabelTransformer(overwrite); 108 | } else if ("csv".equals(format)) { 109 | return new Pds3TableTransformer(overwrite); 110 | } else { 111 | return new Pds3ImageTransformer(overwrite); 112 | } 113 | } else { 114 | throw new TransformException("Format value '" + format 115 | + "' is not one of the valid formats for a PDS3 transformation: " 116 | + Constants.PDS3_VALID_FORMATS); 117 | } 118 | } 119 | } 120 | 121 | public ProductTransformer newInstance(URL target, String format) 122 | throws TransformException { 123 | boolean overwrite = Boolean.parseBoolean( 124 | System.getProperty(OVERWRITE_PROP)); 125 | String extension = FilenameUtils.getExtension(target.toString()); 126 | if (extension.equalsIgnoreCase("xml")) { 127 | if (Constants.PDS4_VALID_FORMATS.contains(format)) { 128 | if ("csv".equals(format)) { 129 | return new Pds4TableTransformer(overwrite); 130 | } else if (Constants.STYLESHEETS.containsKey(format)) { 131 | return new StylesheetTransformer(overwrite); 132 | } else if ("pds3-label".equals(format)) { 133 | return new Pds4LabelTransformer(overwrite); 134 | } else { 135 | return new Pds4ImageTransformer(overwrite); 136 | } 137 | } else { 138 | throw new TransformException("Format value '" + format 139 | + "' is not one of the valid formats for a PDS4 transformation: " 140 | + Constants.PDS4_VALID_FORMATS); 141 | } 142 | } else { 143 | if (Constants.PDS3_VALID_FORMATS.contains(format)) { 144 | if ("pds4-label".equals(format)) { 145 | return new Pds3LabelTransformer(overwrite); 146 | } else if ("csv".equals(format)) { 147 | return new Pds3TableTransformer(overwrite); 148 | } else { 149 | return new Pds3ImageTransformer(overwrite); 150 | } 151 | } else { 152 | throw new TransformException("Format value '" + format 153 | + "' is not one of the valid formats for a PDS3 transformation: " 154 | + Constants.PDS3_VALID_FORMATS); 155 | } 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/label/DelimitedTableLabelTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product.label; 32 | 33 | import java.math.BigInteger; 34 | 35 | import gov.nasa.arc.pds.xml.generated.TableDelimited; 36 | import gov.nasa.pds.objectAccess.table.DelimiterType; 37 | 38 | /** 39 | * Class to transform a non-CSV Table_Delimited object to a 40 | * CSV Table_Delimited object. 41 | * 42 | * @author mcayanan 43 | * 44 | */ 45 | public class DelimitedTableLabelTransformer implements 46 | TableLabelTransformer { 47 | 48 | @Override 49 | public TableDelimited toTableDelimited(Object table) { 50 | return toTableDelimited(table, DelimiterType.COMMA); 51 | } 52 | 53 | @Override 54 | public TableDelimited toTableDelimited(Object table, 55 | DelimiterType type) { 56 | return toTableDelimited((TableDelimited) table, type); 57 | } 58 | 59 | 60 | @Override 61 | public TableDelimited toTableDelimited(TableDelimited table) { 62 | return toTableDelimited(table, DelimiterType.COMMA); 63 | } 64 | 65 | @Override 66 | public TableDelimited toTableDelimited(TableDelimited table, 67 | DelimiterType type) { 68 | if (!table.getFieldDelimiter().equals(type.getXmlType())) { 69 | table.setFieldDelimiter(type.getXmlType()); 70 | } 71 | //Should always set the value to 0 72 | table.getOffset().setValue(BigInteger.valueOf(0)); 73 | return table; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/label/TableLabelTransformer.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product.label; 32 | 33 | import gov.nasa.arc.pds.xml.generated.ByteStream; 34 | import gov.nasa.arc.pds.xml.generated.TableDelimited; 35 | import gov.nasa.pds.objectAccess.table.DelimiterType; 36 | 37 | /** 38 | * Interface class for a TableLabelTransformer. 39 | * 40 | * @author mcayanan 41 | * 42 | * @param Should be one of the PDS4 supported table objects. 43 | */ 44 | public interface TableLabelTransformer { 45 | 46 | /** Convenience wrapper class to convert a given table object 47 | * to a Table_Delimited object with a comma field delimter. 48 | */ 49 | public TableDelimited toTableDelimited(Object table); 50 | 51 | 52 | /** 53 | * Convenience wrapper class to convert a given table object 54 | * to a Table_Delimited object with the given field delimiter. 55 | * 56 | * @param table The table object. 57 | * @param type The field delimiter to set. 58 | * 59 | * @return The transformed Table_Delimited object. 60 | */ 61 | public TableDelimited toTableDelimited(Object table, DelimiterType type); 62 | 63 | /** Converts the given table object to a Table_Delimited object with a 64 | * comma field delimter. 65 | */ 66 | public TableDelimited toTableDelimited(T table); 67 | 68 | /** 69 | * Converts the given table to a TableDelimited object. 70 | * 71 | * @param table The table object to convert. 72 | * @param type The delimiter type to set. 73 | * 74 | * @return The transformed Table_Delimited object. 75 | */ 76 | public TableDelimited toTableDelimited(T table, DelimiterType type); 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/label/TableLabelTransformerFactory.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product.label; 32 | 33 | import gov.nasa.arc.pds.xml.generated.TableBinary; 34 | import gov.nasa.arc.pds.xml.generated.TableCharacter; 35 | import gov.nasa.arc.pds.xml.generated.TableDelimited; 36 | import gov.nasa.pds.transform.TransformException; 37 | 38 | /** 39 | * Class that determines which TableLabelTransformer sub-class 40 | * to instantiate based on the given object. 41 | * 42 | * @author mcayanan 43 | * 44 | */ 45 | public class TableLabelTransformerFactory { 46 | /** Holds the factory object. */ 47 | private static TableLabelTransformerFactory factory = null; 48 | 49 | /** Private constructor. */ 50 | private TableLabelTransformerFactory() {} 51 | 52 | /** 53 | * Gets an instance of the factory. 54 | */ 55 | public static synchronized TableLabelTransformerFactory getInstance() { 56 | if (factory == null) { 57 | factory = new TableLabelTransformerFactory(); 58 | } 59 | return factory; 60 | } 61 | 62 | /** 63 | * Instantiates a new TableLabelTransformer object based on the given 64 | * table object. 65 | * 66 | * @param tableObject Must be either Table_Binary, 67 | * Table_Character, or Table_Delimited. 68 | * 69 | * @return a TableLabelTransformer object. 70 | * 71 | * @throws TransformException If the given object is not one of 72 | * the supported PDS4 table objects. 73 | */ 74 | public TableLabelTransformer newInstance(Object tableObject) 75 | throws TransformException { 76 | if (tableObject instanceof TableBinary) { 77 | return new BinaryTableLabelTransformer(); 78 | } else if (tableObject instanceof TableCharacter) { 79 | return new CharacterTableLabelTransformer(); 80 | } else if (tableObject instanceof TableDelimited) { 81 | return new DelimitedTableLabelTransformer(); 82 | } else { 83 | throw new TransformException( 84 | "Table Object must be 'TableBinary', 'TableCharacter' or 'TableDelimited'"); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/product/pds3/OrderedObjectStatement.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.product.pds3; 32 | 33 | import java.util.ArrayList; 34 | import java.util.List; 35 | 36 | import gov.nasa.pds.tools.label.Label; 37 | import gov.nasa.pds.tools.label.ObjectStatement; 38 | import gov.nasa.pds.tools.label.Statement; 39 | 40 | /** 41 | * An extension of the ObjectStatement object in order to preserve 42 | * the ordering of the statements when they are added to the object. 43 | * This comes in handy in that it allows the statements to be printed 44 | * in order. The parent class stores statements in a Hash Map and sorts 45 | * it by object name. 46 | * 47 | * @author mcayanan 48 | * 49 | */ 50 | public class OrderedObjectStatement extends ObjectStatement { 51 | private List statements; 52 | 53 | /** 54 | * Constructor. 55 | * 56 | * @param sourceLabel The label the object belongs to. 57 | * @param identifier The name of the object. 58 | */ 59 | public OrderedObjectStatement(Label sourceLabel, String identifier) { 60 | super(sourceLabel, identifier); 61 | this.statements = new ArrayList(); 62 | } 63 | 64 | public void addStatement(Statement statement) { 65 | super.addStatement(statement); 66 | this.statements.add(statement); 67 | } 68 | 69 | public List getStatements() { 70 | return this.statements; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/util/ImageProperties.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.util; 32 | 33 | import java.util.List; 34 | 35 | import gov.nasa.arc.pds.xml.generated.DisplaySettings; 36 | import gov.nasa.arc.pds.xml.generated.FileAreaObservational; 37 | 38 | /** 39 | * Class to hold image properties. 40 | * 41 | * @author mcayanan 42 | * 43 | */ 44 | public class ImageProperties { 45 | 46 | /** List of FileAreaObservational elements. */ 47 | private List fileAreas; 48 | 49 | /** List of DisplaySettings. */ 50 | private List displaySettings; 51 | 52 | /** 53 | * Default constructor. 54 | * 55 | * @param fileAreas A list of FileAreaObservational objects. 56 | * @param displaySettings A list of DisplaySettings objects. 57 | */ 58 | public ImageProperties(List fileAreas, 59 | List displaySettings) { 60 | this.fileAreas = fileAreas; 61 | this.displaySettings = displaySettings; 62 | } 63 | 64 | /** 65 | * 66 | * @return the list of FileAreaObservational objects. 67 | */ 68 | public List getFileAreas() { 69 | return fileAreas; 70 | } 71 | 72 | /** 73 | * 74 | * @return the list of DisplaySettings objects. 75 | */ 76 | public List getDisplaySettings() { 77 | return displaySettings; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/util/PDS3LabelWriter.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.util; 32 | 33 | import java.io.FileWriter; 34 | import java.io.IOException; 35 | import java.io.PrintWriter; 36 | import java.util.List; 37 | 38 | import gov.nasa.pds.tools.containers.FileReference; 39 | import gov.nasa.pds.tools.label.AttributeStatement; 40 | import gov.nasa.pds.tools.label.Label; 41 | import gov.nasa.pds.tools.label.PointerStatement; 42 | import gov.nasa.pds.tools.label.Scalar; 43 | import gov.nasa.pds.tools.label.Sequence; 44 | import gov.nasa.pds.tools.label.Set; 45 | import gov.nasa.pds.tools.label.Statement; 46 | import gov.nasa.pds.tools.label.Value; 47 | import gov.nasa.pds.transform.product.pds3.OrderedObjectStatement; 48 | 49 | /** 50 | * Class that writes the label to a file. 51 | * 52 | * @author mcayanan 53 | * 54 | */ 55 | public class PDS3LabelWriter { 56 | private final String CRLF = "\r\n"; 57 | 58 | /** 59 | * Write the given label to a file. It will use the file name 60 | * stored within the given Label object. 61 | * 62 | * @param label The label. 63 | * 64 | * @throws IOException If an error occurred while writing the 65 | * label to a file. 66 | */ 67 | public void write(Label label) throws IOException { 68 | PrintWriter writer = new PrintWriter(new FileWriter(label.getLabelFile())); 69 | try { 70 | for (Statement statement : label.getStatements()) { 71 | printStatement(writer, statement, 0); 72 | } 73 | writer.print("END" + CRLF); 74 | } finally { 75 | writer.flush(); 76 | writer.close(); 77 | } 78 | } 79 | 80 | private void printStatement(PrintWriter writer, Statement statement, int indent) { 81 | String spaces = ""; 82 | for (int i = 0; i < indent; i++) { 83 | spaces += " "; 84 | } 85 | writer.print(spaces); 86 | if (statement instanceof AttributeStatement) { 87 | AttributeStatement a = (AttributeStatement) statement; 88 | writer.print(a.getIdentifier() + " = " + toString(a.getValue()) + CRLF); 89 | } else if (statement instanceof PointerStatement) { 90 | PointerStatement p = (PointerStatement) statement; 91 | writer.print("^" + p.getIdentifier().toString() + " = " + toString(p.getFileRefs()) + CRLF); 92 | } else if (statement instanceof OrderedObjectStatement) { 93 | OrderedObjectStatement o = (OrderedObjectStatement) statement; 94 | writer.print("OBJECT = " + o.getIdentifier().toString() + CRLF); 95 | for (Statement child : o.getStatements()) { 96 | printStatement(writer, child, indent + 2); 97 | } 98 | writer.print(spaces + "END_OBJECT = " + o.getIdentifier().toString() + CRLF + CRLF); 99 | } 100 | } 101 | 102 | private String toString(List fileRefs) { 103 | String result = ""; 104 | FileReference fileRef = fileRefs.get(0); 105 | if (fileRef.getStartPosition() == null || 106 | (fileRef.getStartPosition() != null && fileRef.getStartPosition().getValue().equals("0"))) { 107 | result = "\"" + fileRef.getPath() + "\""; 108 | } else { 109 | result = "(\"" + fileRef.getPath() + "\", " + fileRef.getStartPosition().toString() + " )"; 110 | } 111 | return result; 112 | } 113 | 114 | private String toString(Value value) { 115 | String result = ""; 116 | if (value instanceof Scalar) { 117 | result = ((Scalar) value).toString(); 118 | } else if (value instanceof Sequence) { 119 | Sequence sequence = (Sequence) value; 120 | result = sequence.toString(); 121 | } else if (value instanceof Set) { 122 | Set set = (Set) value; 123 | result = set.toString(); 124 | } 125 | return result; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/util/ToolInfo.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.util; 32 | 33 | import java.io.IOException; 34 | import java.io.InputStream; 35 | import java.net.URL; 36 | import java.util.Properties; 37 | 38 | /** 39 | * Class to get tool release information. 40 | * 41 | * @author mcayanan 42 | * 43 | */ 44 | public class ToolInfo { 45 | /** Properties file name. */ 46 | public static final String FILE = "transform.properties"; 47 | 48 | /** Property key that holds the tool name. */ 49 | public static final String NAME = "transform.name"; 50 | 51 | /** Property key that holds the version. */ 52 | public static final String VERSION = "transform.version"; 53 | 54 | /** Property key that holds the release date. */ 55 | public static final String RELEASE_DATE = "transform.date"; 56 | 57 | /** Property key that holds the copyright information. */ 58 | public static final String COPYRIGHT = "transform.copyright"; 59 | 60 | private static final Properties props = new Properties(); 61 | 62 | static { 63 | try { 64 | URL propertyFile = ToolInfo.class.getResource(FILE); 65 | InputStream in = propertyFile.openStream(); 66 | props.load(in); 67 | } catch (IOException io) { 68 | throw new RuntimeException(io.getMessage()); 69 | } 70 | } 71 | 72 | /** 73 | * Get the name of the tool. 74 | * 75 | * @return The tool name. 76 | */ 77 | public static String getName() { 78 | return props.getProperty(NAME); 79 | } 80 | 81 | /** 82 | * Get the version. 83 | * 84 | * @return The tool version. 85 | */ 86 | public static String getVersion() { 87 | return props.getProperty(VERSION); 88 | } 89 | 90 | /** 91 | * Get the release date. 92 | * 93 | * @return The tool release date. 94 | */ 95 | public static String getReleaseDate() { 96 | return props.getProperty(RELEASE_DATE); 97 | } 98 | 99 | /** 100 | * Get copyright information. 101 | * 102 | * @return The copyright info. 103 | */ 104 | public static String getCopyright() { 105 | return props.getProperty(COPYRIGHT); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/gov/nasa/pds/transform/util/Transcoder.java: -------------------------------------------------------------------------------- 1 | // Copyright © 2019, California Institute of Technology ("Caltech"). 2 | // U.S. Government sponsorship acknowledged. 3 | // 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // 9 | // • Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // • Redistributions must reproduce the above copyright notice, this list of 12 | // conditions and the following disclaimer in the documentation and/or other 13 | // materials provided with the distribution. 14 | // • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | // Laboratory, nor the names of its contributors may be used to endorse or 16 | // promote products derived from this software without specific prior written 17 | // permission. 18 | // 19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | // POSSIBILITY OF SUCH DAMAGE. 30 | 31 | package gov.nasa.pds.transform.util; 32 | 33 | import gov.nasa.pds.transform.TransformException; 34 | 35 | import java.io.File; 36 | import java.util.ArrayList; 37 | import java.util.List; 38 | 39 | import jpl.mipl.io.jConvertIIO; 40 | 41 | /** 42 | * Wrapper class to the Transcoder in the VICAR IO library. 43 | * 44 | * @author mcayanan 45 | * 46 | */ 47 | public class Transcoder { 48 | 49 | /** 50 | * Constructor. 51 | * 52 | */ 53 | public Transcoder() {} 54 | 55 | /** 56 | * Transcode the given input. 57 | * 58 | * @param input The input file. 59 | * @param output The output file. 60 | * @param format The format of the resulting transformation. 61 | * 62 | * @throws TransformException If an error occurred transcoding 63 | * the input file. 64 | */ 65 | public void transcode(File input, File output, String format) 66 | throws TransformException { 67 | transcode(input, output, format, 0, true); 68 | } 69 | 70 | /** 71 | * Transcode the given input. 72 | * 73 | * @param input The input file. 74 | * @param output The output file. 75 | * @param format The format of the resulting transformation. 76 | * @param index The index of the image within the input file. 77 | * @param readAsRenderedImage 'true' to read the input as a rendered 78 | * image, 'false' otherwise. 79 | * 80 | * @throws TransformException If an error occurred transcoding 81 | * the input file. 82 | */ 83 | public void transcode(File input, File output, String format, 84 | int index, boolean readAsRenderedImage) throws TransformException { 85 | List args = new ArrayList(); 86 | args.add("INP=" + input.toString()); 87 | args.add("OUT=" + output.toString()); 88 | if("jp2".equalsIgnoreCase(format)) { 89 | args.add("FORMAT=jpeg2000"); 90 | } else { 91 | args.add("FORMAT=" + format); 92 | } 93 | if (readAsRenderedImage) { 94 | args.add("RI"); 95 | } 96 | if (index != 0) { 97 | args.add("IMAGE_INDEX=" + index); 98 | } 99 | args.add("OFORM=BYTE"); 100 | try { 101 | System.getProperties().setProperty( 102 | "javax.xml.parsers.DocumentBuilderFactory", 103 | "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"); 104 | System.getProperties().setProperty("javax.xml.transform.TransformerFactory", 105 | "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); 106 | jConvertIIO.main(args.toArray(new String[0])); 107 | } catch (Exception e) { 108 | throw new TransformException(e.getMessage()); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/resources/conf/context-classes.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | gov.nasa.pds.imaging.generate.automatic.AutoGeneratedElements 34 | gov.nasa.pds.imaging.generate.util.TextUtil 35 | -------------------------------------------------------------------------------- /src/main/resources/conf/generated-mappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | md5_checksum 35 | gov.nasa.pds.imaging.generate.automatic.elements.Md5Checksum 36 | 37 | 38 | file_size 39 | gov.nasa.pds.imaging.generate.automatic.elements.FileSize 40 | 41 | 42 | file_name 43 | gov.nasa.pds.imaging.generate.automatic.elements.FileName 44 | 45 | 46 | label_length 47 | gov.nasa.pds.imaging.generate.automatic.elements.LabelLength 48 | 49 | 50 | current_date_utc 51 | gov.nasa.pds.imaging.generate.automatic.elements.CurrentDateUTC 52 | 53 | -------------------------------------------------------------------------------- /src/main/resources/conf/velocity-tools.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 57 | 58 | 60 | 61 | 62 | this is bar. 63 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/resources/examples/20140804T205944Z_MAP_bias_V001.fits: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/20140804T205944Z_MAP_bias_V001.fits -------------------------------------------------------------------------------- /src/main/resources/examples/2d234493326edratf3d2537n0m1.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/2d234493326edratf3d2537n0m1.dat -------------------------------------------------------------------------------- /src/main/resources/examples/BA03S183.IMG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/BA03S183.IMG -------------------------------------------------------------------------------- /src/main/resources/examples/C000M5232T493378259EDR_F0000_0134M1.IMG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/C000M5232T493378259EDR_F0000_0134M1.IMG -------------------------------------------------------------------------------- /src/main/resources/examples/ELE_MOM.LBL: -------------------------------------------------------------------------------- 1 | PDS_VERSION_ID = PDS3 2 | RECORD_TYPE = FIXED_LENGTH 3 | RECORD_BYTES = 46 4 | FILE_RECORDS = 2278 5 | ^TABLE = "ELE_MOM.TAB" 6 | DATA_SET_ID = "VG2-J-PLS-5-SUMM-ELE-MOM-96.0SEC-V1.0" 7 | SPACECRAFT_NAME = "VOYAGER 2" 8 | INSTRUMENT_NAME = "PLASMA SCIENCE EXPERIMENT" 9 | TARGET_NAME = JUPITER 10 | START_TIME = 1979-07-06T00:00:42.687Z 11 | STOP_TIME = 1979-07-09T23:59:06.436Z 12 | MISSION_PHASE_NAME = "VOYAGER 2 JUPITER ENCOUNTER" 13 | PRODUCT_ID = "ELE_MOM.TAB" 14 | PRODUCT_TYPE = "DATA" 15 | PRODUCT_CREATION_TIME = "UNK" 16 | SPACECRAFT_CLOCK_START_COUNT = "2/20541:22:726" 17 | SPACECRAFT_CLOCK_STOP_COUNT = "2/20661:20:726" 18 | DESCRIPTION = " 19 | Electron density and moment temperature from the Plasma experiment on 20 | Voyager 2 from the Jupiter encounter. The data set contains 96 second 21 | averages of the electron moment data." 22 | 23 | OBJECT = TABLE 24 | INTERCHANGE_FORMAT = ASCII 25 | ROWS = 2278 26 | COLUMNS = 3 27 | ROW_BYTES = 46 28 | SAMPLING_PARAMETER_NAME = TIME 29 | SAMPLING_PARAMETER_UNIT = SECOND 30 | SAMPLING_PARAMETER_INTERVAL = 96.0 31 | OBJECT = COLUMN 32 | NAME = "TIME" 33 | COLUMN_NUMBER = 1 34 | UNIT = "N/A" 35 | DATA_TYPE = TIME 36 | START_BYTE = 1 37 | BYTES = 24 38 | DESCRIPTION = " 39 | Time column. This field contains time in PDS format 40 | yyyy-mm-ddThh:mm:ss.sssZ. The individual elements of the 41 | time field can be read using the format 42 | (i4,4(1x,i2),1x,f6.3) yr, mon, day, hr, min, sec." 43 | END_OBJECT = COLUMN 44 | OBJECT = COLUMN 45 | NAME = "ELE_DEN" 46 | COLUMN_NUMBER = 2 47 | UNIT = "COUNT/CM**3" 48 | DATA_TYPE = ASCII_REAL 49 | START_BYTE = 25 50 | BYTES = 10 51 | MISSING_CONSTANT = -9.99e+10 52 | DESCRIPTION = " 53 | Column contains total electron moment density in counts/cm^3." 54 | END_OBJECT = COLUMN 55 | OBJECT = COLUMN 56 | NAME = "ELE_TEMP" 57 | COLUMN_NUMBER = 3 58 | UNIT = "ELECTRONVOLT" 59 | DATA_TYPE = ASCII_REAL 60 | START_BYTE = 35 61 | BYTES = 10 62 | MISSING_CONSTANT = -9.99e+10 63 | DESCRIPTION = " 64 | Column contains total electron moment temperature in units of 65 | electron volts." 66 | END_OBJECT = COLUMN 67 | 68 | END_OBJECT = TABLE 69 | END 70 | -------------------------------------------------------------------------------- /src/main/resources/examples/FF01.IMG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/FF01.IMG -------------------------------------------------------------------------------- /src/main/resources/examples/FF01.LBL: -------------------------------------------------------------------------------- 1 | PDS_VERSION_ID = PDS3 2 | /* Framelet file format, size and location */ 3 | RECORD_TYPE = FIXED_LENGTH 4 | RECORD_BYTES = 1024 5 | FILE_RECORDS = 1026 6 | ^IMAGE_HEADER = ("FF01.IMG",1) 7 | ^IMAGE = ("FF01.IMG",3) 8 | /* Framelet description */ 9 | DATA_SET_ID = 'MGN-V-RDRS-5-MIDR-FULL-RES-V1.0' 10 | SPACECRAFT_NAME = MAGELLAN 11 | MISSION_PHASE_NAME = PRIMARY_MISSION 12 | TARGET_NAME = VENUS 13 | IMAGE_ID = 'F-MIDR.20S145;1' 14 | INSTRUMENT_NAME = 'RADAR SYSTEM' 15 | /* Description of objects contained in the framelet */ 16 | OBJECT = IMAGE_HEADER 17 | TYPE = VICAR2 18 | BYTES = 1024 19 | RECORDS = 2 20 | END_OBJECT = IMAGE_HEADER 21 | OBJECT = IMAGE 22 | LINES = 1024 23 | LINE_SAMPLES = 1024 24 | SAMPLE_TYPE = UNSIGNED_INTEGER 25 | SAMPLE_BITS = 8 26 | NOTE = " 27 | DN = INT((MIN(MAX(RV,-20),30) + 20) * 5) + 1, 28 | where RV = radar crossection/area divided by the 29 | Muhleman Law and converted to decibels. Muhleman Law 30 | multiplicative constant of 0.0118 was used. (Note: Intention 31 | was to use 0.0188.)" 32 | END_OBJECT = IMAGE 33 | 34 | OBJECT = IMAGE_MAP_PROJECTION_CATALOG 35 | ^DATA_SET_MAP_PROJECT_CATALOG = 'DSMAPF.LBL' 36 | DATA_SET_ID = 'MGN-V-RDRS-5-MIDR-FULL-RES-V1.0' 37 | IMAGE_ID = 'F-MIDR.20S145;1' 38 | MAP_PROJECTION_TYPE = SINUSOIDAL 39 | MAP_RESOLUTION = 1407.4 40 | MAP_SCALE = 75 41 | MAXIMUM_LATITUDE = -17.4548 42 | MAXIMUM_LONGITUDE = 142.4009 43 | MINIMUM_LATITUDE = -18.1813 44 | MINIMUM_LONGITUDE = 141.6269 45 | X_AXIS_PROJECTION_OFFSET = -24579 46 | Y_AXIS_PROJECTION_OFFSET = 4096 47 | X_AXIS_FRAMELET_OFFSET = 1 48 | Y_AXIS_FRAMELET_OFFSET = 1 49 | A_AXIS_RADIUS = 6051.92 50 | B_AXIS_RADIUS = 6051.92 51 | C_AXIS_RADIUS = 6051.92 52 | FIRST_STANDARD_PARALLEL = 0.0000 53 | SECOND_STANDARD_PARALLEL = 'N/A' 54 | POSITIVE_LONGITUDE_DIRECTION = EAST 55 | CENTER_LATITUDE = 0.0000 56 | CENTER_LONGITUDE = 144.6882 57 | REFERENCE_LATITUDE = 'N/A' 58 | REFERENCE_LONGITUDE = 'N/A' 59 | X_AXIS_FIRST_PIXEL = 1 60 | Y_AXIS_FIRST_PIXEL = 1 61 | X_AXIS_LAST_PIXEL = 1024 62 | Y_AXIS_LAST_PIXEL = 1024 63 | MAP_PROJECTION_ROTATION = 0.0000 64 | END_OBJECT = IMAGE_MAP_PROJECTION_CATALOG 65 | END 66 | -------------------------------------------------------------------------------- /src/main/resources/examples/FHA01118.IMG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/FHA01118.IMG -------------------------------------------------------------------------------- /src/main/resources/examples/N1727539187_1.IMG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/N1727539187_1.IMG -------------------------------------------------------------------------------- /src/main/resources/examples/N1727539187_1.LBL: -------------------------------------------------------------------------------- 1 | PDS_VERSION_ID = PDS3 2 | 3 | /* FILE CHARACTERISTICS */ 4 | 5 | RECORD_TYPE = FIXED_LENGTH 6 | RECORD_BYTES = 2072 7 | FILE_RECORDS = 1027 8 | 9 | /* POINTERS TO DATA OBJECTS */ 10 | 11 | ^IMAGE_HEADER = ("N1727539187_1.IMG",1) 12 | ^TELEMETRY_TABLE = ("N1727539187_1.IMG",3) 13 | ^LINE_PREFIX_TABLE = ("N1727539187_1.IMG",4) 14 | ^IMAGE = ("N1727539187_1.IMG",4) 15 | 16 | /* IDENTIFICATION DATA ELEMENTS */ 17 | 18 | ANTIBLOOMING_STATE_FLAG = "ON" 19 | BIAS_STRIP_MEAN = 18.548109 20 | CALIBRATION_LAMP_STATE_FLAG = "N/A" 21 | COMMAND_FILE_NAME = "trigger_10368_1.ioi" 22 | COMMAND_SEQUENCE_NUMBER = 10368 23 | DARK_STRIP_MEAN = 0.735323 24 | DATA_CONVERSION_TYPE = "12BIT" 25 | DATA_SET_ID = "CO-S-ISSNA/ISSWA-2-EDR-V1.0" 26 | DELAYED_READOUT_FLAG = "NO" 27 | DESCRIPTION = "N/A" 28 | DETECTOR_TEMPERATURE = -89.318428 29 | EARTH_RECEIVED_START_TIME = 2012-273T00:06:46.557 30 | EARTH_RECEIVED_STOP_TIME = 2012-273T00:07:52.940 31 | ELECTRONICS_BIAS = 112 32 | EXPECTED_MAXIMUM = (56.543201,62.339600) 33 | EXPECTED_PACKETS = 831 34 | EXPOSURE_DURATION = 38000.000000 35 | FILTER_NAME = ("CL1","CB3") 36 | FILTER_TEMPERATURE = -0.468354 37 | FLIGHT_SOFTWARE_VERSION_ID = "1.4" 38 | GAIN_MODE_ID = "29 ELECTRONS PER DN" 39 | IMAGE_MID_TIME = 2012-272T15:06:21.685 40 | IMAGE_NUMBER = "1727539187" 41 | IMAGE_OBSERVATION_TYPE = {"SCIENCE"} 42 | IMAGE_TIME = 2012-272T15:06:40.685 43 | INSTRUMENT_DATA_RATE = 182.783997 44 | INSTRUMENT_HOST_NAME = "CASSINI ORBITER" 45 | INSTRUMENT_ID = "ISSNA" 46 | INSTRUMENT_MODE_ID = "FULL" 47 | INSTRUMENT_NAME = "IMAGING SCIENCE SUBSYSTEM - NARROW ANGLE" 48 | INST_CMPRS_PARAM = ("N/A","N/A","N/A","N/A") 49 | INST_CMPRS_RATE = (5.802420,5.442307) 50 | INST_CMPRS_RATIO = 2.939930 51 | INST_CMPRS_TYPE = "LOSSLESS" 52 | LIGHT_FLOOD_STATE_FLAG = "ON" 53 | METHOD_DESC = "ISSPT2.8;Titan;ISS_172TI_CLOUD002_PRIME" 54 | MISSING_LINES = 0 55 | MISSING_PACKET_FLAG = "NO" 56 | MISSION_NAME = "CASSINI-HUYGENS" 57 | MISSION_PHASE_NAME = "EXTENDED-EXTENDED MISSION" 58 | OBSERVATION_ID = "ISS_172TI_CLOUD002_PRIME" 59 | OPTICS_TEMPERATURE = (0.712693,1.905708) 60 | ORDER_NUMBER = 3 61 | PARALLEL_CLOCK_VOLTAGE_INDEX = 9 62 | PREPARE_CYCLE_INDEX = 8 63 | PRODUCT_CREATION_TIME = 2012-273T04:57:56.000 64 | PRODUCT_ID = "1_N1727539187.122" 65 | PRODUCT_VERSION_TYPE = "FINAL" 66 | READOUT_CYCLE_INDEX = 5 67 | RECEIVED_PACKETS = 781 68 | SENSOR_HEAD_ELEC_TEMPERATURE = 1.633024 69 | SEQUENCE_ID = "S75" 70 | SEQUENCE_NUMBER = 15 71 | SEQUENCE_TITLE = "ISS_172TI_CLOUD002_PRIME" 72 | SHUTTER_MODE_ID = "NACONLY" 73 | SHUTTER_STATE_ID = "ENABLED" 74 | SOFTWARE_VERSION_ID = "ISS 11.00 05-24-2006" 75 | SPACECRAFT_CLOCK_CNT_PARTITION = 1 76 | SPACECRAFT_CLOCK_START_COUNT = "1727539149.122" 77 | SPACECRAFT_CLOCK_STOP_COUNT = "1727539187.122" 78 | START_TIME = 2012-272T15:06:02.685 79 | STOP_TIME = 2012-272T15:06:40.685 80 | TARGET_DESC = "Titan" 81 | TARGET_LIST = "N/A" 82 | TARGET_NAME = "TITAN" 83 | TELEMETRY_FORMAT_ID = "S&ER3" 84 | VALID_MAXIMUM = (4095,4095) 85 | OBJECT = IMAGE_HEADER 86 | INTERCHANGE_FORMAT = ASCII 87 | HEADER_TYPE = VICAR2 88 | BYTES = 4144 89 | RECORDS = 1 90 | ^DESCRIPTION = "../../label/vicar2.txt" 91 | END_OBJECT = IMAGE_HEADER 92 | OBJECT = TELEMETRY_TABLE 93 | INTERCHANGE_FORMAT = BINARY 94 | ROWS = 1 95 | COLUMNS = 2 96 | ROW_BYTES = 2072 97 | ^STRUCTURE = "../../label/tlmtab.fmt" 98 | OBJECT = COLUMN 99 | NAME = NULL_PADDING 100 | DATA_TYPE = MSB_UNSIGNED_INTEGER 101 | START_BYTE = 61 102 | BYTES = 2011 103 | END_OBJECT = COLUMN 104 | END_OBJECT = TELEMETRY_TABLE 105 | OBJECT = LINE_PREFIX_TABLE 106 | INTERCHANGE_FORMAT = BINARY 107 | ROWS = 1024 108 | COLUMNS = 10 109 | ROW_BYTES = 24 110 | ROW_SUFFIX_BYTES = 2048 111 | ^LINE_PREFIX_STRUCTURE = "../../label/prefix3.fmt" 112 | END_OBJECT = LINE_PREFIX_TABLE 113 | OBJECT = IMAGE 114 | LINES = 1024 115 | LINE_SAMPLES = 1024 116 | SAMPLE_BITS = 16 117 | SAMPLE_TYPE = SUN_INTEGER 118 | LINE_PREFIX_BYTES = 24 119 | END_OBJECT = IMAGE 120 | END 121 | -------------------------------------------------------------------------------- /src/main/resources/examples/PDS4_ATM_TABLE_CHAR.TAB: -------------------------------------------------------------------------------- 1 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG" 2 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG" 3 | 91,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"SS091A990R6M1.IMG" 4 | 91,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"SS091A990R6M1.IMG" 5 | 91,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"SS091AA00R6M1.IMG" 6 | 91,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG" 7 | 91,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG" 8 | 91,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG" 9 | 91,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG" 10 | 91,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG" 11 | 91,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG" 12 | 91,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG" 13 | 91,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG" 14 | 91,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG" 15 | 91,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG" 16 | 91,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG" 17 | 91,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG" 18 | 91,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG" 19 | 91,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG" 20 | 91,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG" 21 | 91,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG" 22 | 151,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG" 23 | 151,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG" 24 | -------------------------------------------------------------------------------- /src/main/resources/examples/PDS4_ATM_TABLE_CHAR_MULTIPLE.TAB: -------------------------------------------------------------------------------- 1 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG" 2 | 91,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"SS091A990R6M1.IMG" 3 | 91,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"SS091A990R6M1.IMG" 4 | 91,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"SS091A990R6M1.IMG" 5 | 91,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"SS091AA00R6M1.IMG" 6 | 91,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG" 7 | 91,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG" 8 | 91,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG" 9 | 91,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG" 10 | 91,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG" 11 | 91,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG" 12 | 91,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG" 13 | 91,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG" 14 | 91,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG" 15 | 91,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG" 16 | 91,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG" 17 | 91,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG" 18 | 91,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG" 19 | 91,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG" 20 | 91,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG" 21 | 91,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG" 22 | 151,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG" 23 | 151,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG" 24 | 25 | 10,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"BLAH.IMG " 26 | 10,0.088, 91.06951,5.156,0.42,0.42656,125.547152, 4.7691,15300.0,"BLAH.IMG " 27 | 10,0.088, 91.07029,5.155,0.42,0.42652,125.550546, 4.7692,15300.0,"BLAH.IMG " 28 | 10,0.089, 91.07105,5.155,0.42,0.42657,125.550344, 4.7692,15300.0,"BLAH.IMG " 29 | 10,0.377, 91.35854,2.225,0.72,0.56432,147.854445, 19.1305, 4314.6,"BLAH.IMG " 30 | 10,0.377, 91.35919,2.010,0.64,0.51506,197.022189, 18.7507, 4314.6,"SS091AA00R6M1.IMG" 31 | 10,0.378, 91.35978,1.928,0.70,0.52962,199.881316, 21.4121, 4314.6,"SS091AA00R6M1.IMG" 32 | 10,0.379, 91.36042,1.366,1.71,0.71758,185.232248,180.0000, 4314.6,"SS091AA00R6M1.IMG" 33 | 10,0.379, 91.36104,1.494,1.47,0.69841,179.932613, 81.2461, 4314.6,"SS091AA00R6M1.IMG" 34 | 10,0.380, 91.36165,1.908,0.83,0.58457,171.164927, 25.8445, 4314.6,"SS091AA00R6M1.IMG" 35 | 10,0.380, 91.36229,1.677,1.13,0.65682,169.245035, 42.4206, 4314.6,"SS091AA00R6M1.IMG" 36 | 10,0.381, 91.36289,1.720,0.87,0.57686,237.047264, 30.6785, 4314.6,"SS091AA00R6M1.IMG" 37 | 10,0.382, 91.36415,2.645,0.49,0.40090,323.650451, 10.7665, 4314.6,"SS091AA00R6M1.IMG" 38 | 10,0.383, 91.36477,4.752,0.40,0.39856, 10.696469, 4.8413, 4314.6,"SS091AA00R6M1.IMG" 39 | 10,0.384, 91.36543,4.521,0.40,0.39494,358.661558, 5.1823, 4314.6,"SS091AA00R6M1.IMG" 40 | 10,0.384, 91.36604,3.427,0.39,0.38187, 13.809568, 6.6027, 4314.6,"SS091AA00R6M1.IMG" 41 | 10,0.385, 91.36663,3.239,0.39,0.37979, 4.907225, 7.0238, 4314.6,"SS091AA00R6M1.IMG" 42 | 10,0.385, 91.36729,2.826,0.42,0.39259,317.423490, 8.7466, 4314.6,"SS091AA00R6M1.IMG" 43 | 10,0.386, 91.36792,2.840,0.42,0.39058,321.608207, 8.6859, 4314.6,"SS091AA00R6M1.IMG" 44 | 10,0.387, 91.36851,3.124,0.39,0.37922,339.039685, 7.3389, 4314.6,"SS091AA00R6M1.IMG" 45 | 10,0.387, 91.36917,3.317,0.39,0.37703,352.720837, 6.7690, 4314.6,"SS091AA00R6M1.IMG" 46 | 110,0.229,151.20464,2.980,0.43,0.40324,293.965171, 8.3952, 7140.0,"SS1520900R6M1.IMG" 47 | 110,0.230,151.20527,3.072,0.46,0.41565,268.822094, 8.6166, 7140.0,"SS1520900R6M1.IMG" 48 | -------------------------------------------------------------------------------- /src/main/resources/examples/PDS4_TABLE_DELIMITED.csv: -------------------------------------------------------------------------------- 1 | 27,127,117,19,6,5,5,7,2,3,1,2,6 2 | 28,128,57,34,49,35,30,29,19,8,19,24,11216 3 | 29,202,139,101,96,94,74,71,73,66,70,77,10343 4 | -------------------------------------------------------------------------------- /src/main/resources/examples/PWR02176_01.LBL: -------------------------------------------------------------------------------- 1 | PDS_VERSION_ID = PDS3 2 | INTERCHANGE_FORMAT = ASCII 3 | RECORD_TYPE = FIXED_LENGTH 4 | RECORD_BYTES = 195 5 | FILE_RECORDS = 269 6 | DATA_SET_ID = "ODY-M-MAR-2-REDR-RAW-DATA-V1.0" 7 | MISSION_PHASE_NAME = "MAPPING" 8 | SPACECRAFT_NAME = "2001 MARS ODYSSEY" 9 | START_TIME = 2002-06-24T00:23:01.21Z 10 | STOP_TIME = 2002-06-25T00:40:01.72Z 11 | SPACECRAFT_CLOCK_START_COUNT = "UNK" 12 | SPACECRAFT_CLOCK_STOP_COUNT = "UNK" 13 | INSTRUMENT_ID = "MARIE" 14 | INSTRUMENT_NAME = "MARTIAN RADIATION ENVIRONMENT EXPERIMENT" 15 | PRODUCT_ID = "PWR02176_01.TAB" 16 | PRODUCT_TYPE = "ANCILLARY" 17 | ORIGINAL_PRODUCT_ID = "N/A" 18 | FILE_NAME = "PWR02176_01.TAB" 19 | NOTE = "Ancillary data from the MARIE 20 | instrument on the 2001 Mars Odyssey spacecraft. Power 21 | consumption of circuits in the instrument." 22 | DESCRIPTION = " 23 | This data file contains ancillary data from the Martian Radiation 24 | Environment Experiment (MARIE) on the 2001 Mars Odyssey 25 | spacecraft. MARIE is a radiation measuring instrument that 26 | counts particles in the energy range 15 MeV to 500 MeV/n. 27 | 28 | This data file contains values of the power consumption by 29 | various circuits on the MARIE instrument, in ASCII format. 30 | The file consists of an attached header (1 line) followed by 31 | a data table. In each row of the data table, the first two 32 | columns represent UTC time, the third column represents Julian 33 | time, and the rest of the columns contain values of the 34 | power consumption. Further information on the columns is 35 | provided in the STRUCTURE file referenced below." 36 | 37 | ^TABLE_HEADER = ("PWR02176_01.TAB", 1) 38 | ^TABLE = ("PWR02176_01.TAB", 2) 39 | OBJECT = TABLE_HEADER 40 | BYTES = 'N/A' 41 | RECORDS = 1 42 | PUBLICATION_DATE = 2002-01-10 43 | NOTE = "The first record of this 44 | file makes up the header. The header includes column headings 45 | for the data table. This line ends with a carriage return/ 46 | line feed terminator ()." 47 | END_OBJECT = TABLE_HEADER 48 | 49 | OBJECT = TABLE 50 | NAME = POWER 51 | INTERCHANGE_FORMAT = ASCII 52 | ROWS = 268 53 | ROW_BYTES = 195 54 | COLUMNS = 11 55 | DESCRIPTION = " 56 | The power consumption readings are stored in an ASCII table 57 | structure that immediately follows the attached header. This file 58 | contains rows of time-tagged sets of power values." 59 | ^STRUCTURE = "PWR.FMT" 60 | END_OBJECT = TABLE 61 | 62 | END 63 | -------------------------------------------------------------------------------- /src/main/resources/examples/b0090_p243401_01_01v02.qub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/b0090_p243401_01_01v02.qub -------------------------------------------------------------------------------- /src/main/resources/examples/ba03s183.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 10 | 11 | urn:nasa:pds:data:clem1-l-u-5-dim-basemap-v1.0:ba03s183 12 | 1.0 13 | clem1-l-u-5-dim-basemap-v1.0 ba03s183 14 | 1.9.0.0 15 | Product_Observational 16 | 17 | 18 | 2018-06-06 19 | 1.0 20 | Auto generated PDS4 product label created by the Transform Tool. 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | deep space program science experiment 31 | Mission 32 | 33 | urn:nasa:pds:investigation.deep.space.program.science.experiment 34 | data_to_investigation 35 | 36 | 37 | 38 | 39 | ultraviolet/visible camera 40 | Instrument 41 | 42 | 43 | 44 | moon 45 | Planet 46 | 47 | 48 | 49 | 50 | BA03S183.IMG 51 | 52 | 53 | ARRAY_0 54 | 7376 55 | 2 56 | Last Index Fastest 57 | 58 | SignedMSB2 59 | 60 | 61 | Line 62 | 2127 63 | 1 64 | 65 | 66 | Sample 67 | 1844 68 | 2 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/resources/examples/ff01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 10 | 11 | urn:nasa:pds:data:mgn-v-rdrs-5-midr-full-res-v1.0:ff01.lbl 12 | 1.0 13 | mgn-v-rdrs-5-midr-full-res-v1.0 14 | 1.10.0.0 15 | Product_Observational 16 | 17 | 18 | 2018-06-11 19 | 1.0 20 | Auto generated PDS4 product label created by the Transform Tool. 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | primary_mission 31 | Mission 32 | 33 | urn:nasa:pds:investigation.primary_mission 34 | data_to_investigation 35 | 36 | 37 | 38 | 39 | radar system 40 | Instrument 41 | 42 | 43 | 44 | venus 45 | Planet 46 | 47 | 48 | 49 | 50 | FF01.IMG 51 | 52 | 53 | FF01-Array_2D_Image 54 | 2048 55 | 2 56 | Last Index Fastest 57 | 58 | UnsignedByte 59 | 60 | 61 | Line 62 | 1024 63 | 1 64 | 65 | 66 | Sample 67 | 1024 68 | 2 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/main/resources/examples/i943630r.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/main/resources/examples/i943630r.raw -------------------------------------------------------------------------------- /src/main/resources/external-programs/external-programs.properties: -------------------------------------------------------------------------------- 1 | # Copyright © 2019, California Institute of Technology ("Caltech"). 2 | # U.S. Government sponsorship acknowledged. 3 | # 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # • Redistributions of source code must retain the above copyright notice, 10 | # this list of conditions and the following disclaimer. 11 | # • Redistributions must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other 13 | # materials provided with the distribution. 14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | # Laboratory, nor the names of its contributors may be used to endorse or 16 | # promote products derived from this software without specific prior written 17 | # permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | pds=python/coiss_data_to_pds4.py -------------------------------------------------------------------------------- /src/main/resources/external-programs/python/coiss_data_to_pds4.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | # 3 | # Copyright © 2019, California Institute of Technology ("Caltech"). 4 | # U.S. Government sponsorship acknowledged. 5 | # 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions are met: 10 | # 11 | # • Redistributions of source code must retain the above copyright notice, 12 | # this list of conditions and the following disclaimer. 13 | # • Redistributions must reproduce the above copyright notice, this list of 14 | # conditions and the following disclaimer in the documentation and/or other 15 | # materials provided with the distribution. 16 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 17 | # Laboratory, nor the names of its contributors may be used to endorse or 18 | # promote products derived from this software without specific prior written 19 | # permission. 20 | # 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | # POSSIBILITY OF SUCH DAMAGE. 32 | ################################################################################ 33 | # coiss_data_to_pds4.py 34 | # 35 | # Sample program to read the contents of a Cassini ISS data file and save the 36 | # data objects as unformatted binary files. 37 | # 38 | # Mark Showalter, PDS Rings Node, SETI Institute, 8/24/13 39 | ################################################################################ 40 | 41 | import sys 42 | sys.dont_write_bytecode=True 43 | import numpy as np 44 | from vicar import VicarImage 45 | 46 | def coiss_data_to_pds4(vicar_filepath, array_filepath, 47 | prefix_filepath=None, 48 | binary_header_filepath=None): 49 | 50 | """Reads a raw Cassini image file in VICAR format and saves its contents 51 | in one or more data files. 52 | 53 | Input: 54 | vicar_filepath full file path to the raw Cassini image file. 55 | array_filepath path to the output file for the data array. 56 | prefix_filepath path to the output file for the prefix bytes of 57 | the array; use None to suppress the writing of this 58 | file. 59 | binary_header_filepath 60 | path to the output file for the binary header; use 61 | None to suppress the writing of this file. 62 | 63 | Return: A Python dictionary containing the VICAR keywords 64 | and their values. 65 | 66 | Note: Output files are written using the same binary format and byte order 67 | as the original VICAR file. 68 | """ 69 | 70 | vicar_object = VicarImage.from_file(vicar_filepath) 71 | 72 | vicar_object.data_2d.tofile(array_filepath) 73 | 74 | if prefix_filepath is not None: 75 | vicar_object.prefix_2d.tofile(prefix_filepath) 76 | 77 | if binary_header_filepath is not None: 78 | vicar_object.binary_header.tofile(binary_header_filepath) 79 | 80 | return vicar_object.as_dict() 81 | 82 | if __name__ == "__main__": 83 | inputfile = sys.argv[1] 84 | outputfile = sys.argv[2] 85 | result = coiss_data_to_pds4(inputfile, outputfile) 86 | 87 | ################################################################################ 88 | -------------------------------------------------------------------------------- /src/main/resources/stylesheets/html-structure-only.xsl: -------------------------------------------------------------------------------- 1 | 2 | 33 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | <xsl:value-of select="./*[name()='Identification_Area']/*[name()='title']"/> 46 | 47 | 48 | 49 | 50 | 51 |
52 | 53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
65 | 66 | 67 |
68 |
69 |
70 | 71 |
72 | -------------------------------------------------------------------------------- /src/main/resources/stylesheets/html.xsl: -------------------------------------------------------------------------------- 1 | 2 | 33 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | <xsl:value-of select="./*[name()='Identification_Area']/*[name()='title']"/> 45 | 46 | 47 | 48 | 49 |
50 | 51 | 52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | 65 | 66 |
67 | 68 | 69 | 70 |
71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
85 | -------------------------------------------------------------------------------- /src/main/resources/stylesheets/pvl.xsl: -------------------------------------------------------------------------------- 1 | 2 | 33 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | BEGIN_OBJECT = 48 | 49 | 50 | 51 | 52 | 53 | END_OBJECT = ; 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | = 62 | 63 | ""; 64 | 65 | ; 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/resources/stylesheets/stylesheets.properties: -------------------------------------------------------------------------------- 1 | # Copyright © 2019, California Institute of Technology ("Caltech"). 2 | # U.S. Government sponsorship acknowledged. 3 | # 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # • Redistributions of source code must retain the above copyright notice, 10 | # this list of conditions and the following disclaimer. 11 | # • Redistributions must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other 13 | # materials provided with the distribution. 14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | # Laboratory, nor the names of its contributors may be used to endorse or 16 | # promote products derived from this software without specific prior written 17 | # permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | pvl=pvl.xsl 32 | html=html.xsl 33 | html-structure-only=html-structure-only.xsl 34 | -------------------------------------------------------------------------------- /src/main/resources/transform.properties: -------------------------------------------------------------------------------- 1 | # Copyright © 2019, California Institute of Technology ("Caltech"). 2 | # U.S. Government sponsorship acknowledged. 3 | # 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # • Redistributions of source code must retain the above copyright notice, 10 | # this list of conditions and the following disclaimer. 11 | # • Redistributions must reproduce the above copyright notice, this list of 12 | # conditions and the following disclaimer in the documentation and/or other 13 | # materials provided with the distribution. 14 | # • Neither the name of Caltech nor its operating division, the Jet Propulsion 15 | # Laboratory, nor the names of its contributors may be used to endorse or 16 | # promote products derived from this software without specific prior written 17 | # permission. 18 | # 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | # POSSIBILITY OF SUCH DAMAGE. 30 | 31 | transform.name=${project.name} 32 | transform.version=Version ${project.version} 33 | transform.date=${buildNumber} 34 | transform.copyright=\nCopyright 2019, by the California Institute of Technology ("Caltech").\nAll rights reserved. 35 | -------------------------------------------------------------------------------- /src/site/resources/images/pds4_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/pds4_logo.png -------------------------------------------------------------------------------- /src/site/resources/images/windows_panel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/windows_panel.jpg -------------------------------------------------------------------------------- /src/site/resources/images/windows_search.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NASA-PDS/transform/c9e8ed9c5d2139ae78318db77ba1c63d4cef3dd6/src/site/resources/images/windows_search.jpg -------------------------------------------------------------------------------- /src/site/site.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | 35 | org.apache.maven.skins 36 | maven-fluido-skin 37 | 2.0.0-M6 38 | 39 | 40 | 41 | 42 | nasa-pds/${project.artifactId} 43 | right 44 | black 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 55 | 56 | 57 | 60 | 61 | 62 | PDS Transform Tool 63 | https://pds.nasa.gov 64 | 65 | 66 | 67 | 68 | 69 | 70 |

71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/site/xdoc/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | 35 | About Transform Tool 36 | Michael Cayanan 37 | Sean Hardman 38 | 39 | 40 | 41 |
42 |

The Transform Tool project contains software for transforming PDS3 and PDS4 product labels and product data into other formats. The following transformations are currently supported: 43 |

44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
InputOutputComment
PDS3 Image
(8-bit Image)
(16-bit Image)
GIF, JPEG, JPEG 2000, PNG, PNM, TIFFKnown limitations:
- Does not yet support product labels referencing multiple images, including explicit FILE objects
- Does not yet support Qube objects
PDS3 TableCSV
PDS4 Labeled Table
The resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards.
PDS3 LabelPDS4 LabelThe resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards.
PDS4 Table
(Table_Binary)
(Table_Character)
(Table_Delimited)
CSV
PDS4 Labeled Table
The resulting product label contains the minimum set of elements in order to be compliant with the PDS4 standards.
PDS4 2D Image
(Array_2D_Image)
GIF, JPEG, JPEG 2000, PNG, PNM, TIFF, FITS
PDS4 3D Image
(Array_3D_Image)
GIF, JPEG, JPEG 2000, PNG, PNM, TIFFThe current implementation defaults to transforming band 1. Will add support for selecting bands in the future.
PDS4 3D Hyper-Spectral Cube
(Array_3D_Spectrum)
GIF, JPEG, JPEG 2000, PNG, PNM, TIFFThe current implementation defaults to transforming band 1. Will add support for selecting bands in the future.
PDS4 LabelPDS3 LabelThe resulting product label contains the minimum set of elements in order to be compliant with the PDS3 standards.

Known limitations:
- Does not yet support a PDS4 label containing multiple File_Area_Observational elements.
- Does not yet support a PDS4 label containing Group_Field_Delimited elements
- Does not yet support a PDS4 label describing a Qube data object
PDS4 LabelObject Description Language (ODL)
Parameter Value Language (PVL)
HTML
57 | 58 |

Please send comments, change requests and bug reports to the PDS Operator at pds_operator@jpl.nasa.gov. 59 |

60 |
61 | 62 |
63 | -------------------------------------------------------------------------------- /src/site/xdoc/install/index-win.xml.vm: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | 35 | Windows System Properties 36 | Michael Cayanan 37 | Sean Hardman 38 | 39 | 40 | 41 |
42 |

The required environment variables for the ${project.artifactId} package can also be set through the Windows system properties panel. The instructions provided below were based off of a Windows 7 machine. Windows 8 and 10 users should be able to use these steps as well to modify their environment. 43 |

44 | 45 |

The Path environment variable can be modified as follows: 46 |

47 | 48 |
    49 |
  • Click on the Windows icon on the bottom left. In the search text box, type in edit system environment variables. A search result called Edit the system environment variables should appear under the Control Panel area as follows: 50 |
  • 51 |
52 | 53 |
54 | 55 |
    56 |
  • Click on Edit the system environment variables and in there, click on the Environment Variables button. At this point, you should now see a window like the one below: 57 |
  • 58 |
59 | 60 |
61 | 62 |
    63 |
  • Highlight the Path variable in the System Variables list and select the Edit button. 64 |
  • 65 |
  • Append to the current contents of the variable, the path to the bin directory within ${project.artifactId} package. Separate the package path from the current contents of the variable with a semicolon. 66 |
  • 67 |
  • Select the OK button when you are finished editing the Path variable, then select the OK button on the Environment Variables window to apply the changes. 68 |
  • 69 |
70 | 71 |

New environment variables (e.g., JAVA_HOME) may also be specified in the system properties panel. Instead of selecting the Edit button from the System Variables list, select the New button and enter the variable name and value. Select the OK button when you are finished, then select the OK button on the Environment Variables window to apply the changes. 72 |

73 | 74 |

Note: If you already have a DOS window open, you will need to close and re-open the window for the environment variable changes to take effect. 75 |

76 |
77 | 78 |
79 | --------------------------------------------------------------------------------